Set up multiple websites on a local web server

Posted by mickburkejnr on Server Fault See other posts from Server Fault or by mickburkejnr
Published on 2012-11-20T12:39:26Z Indexed on 2012/11/20 17:03 UTC
Read the original article Hit count: 243

Filed under:
|

I have spent the last few days setting up a CentOS 6 server on my local network so that I can host multiple projects that I'm currently working on. Everything has been set up so that I access the server by typing 192.168.1.10 and the Apache test page comes up.

What I'm aiming to do is to access different projects by typing in 192.168.1.10/project, and then view the project as if it was on it's own standalone server. I have thought about just sticking these sites inside folders on the server then accessing them that way, but a lot of my projects use CakePHP so this isn't feasible.

So what I need to do is create VirtualHosts in Apache to allow me to do this, but without using a domain name. I want to stick to using the IP address of the machine (which is static).

Any ideas?

EDIT
I've followed Peter's suggestion, but now I have a new problem.

In the httpd.conf file I have entered the following information:

NameVirtualHost *:80

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /www/html/project1
     ServerName local.project1.com
     ErrorLog logs/local.project1.com-error_log
     CustomLog logs/local.project1.com-access_log common
</VirtualHost>

And now Apache is saying:

Starting httpd: Warning: DocumentRoot [/www/html/project1] does not exist

When it clearly does exist. I've disabled SELinux and I can confirm this isn't turned on. I've also checked the ownership of the folder, and its owned by root. I can also save files to these folders using a guest FTP account (which isn't associated to root), so the folders are being listed and can be written to. But when I try the folder in a web browser it doesn't seem to work either. I've also done a reboot of the server and the problem persists.

What should I change in order to resolve this?

© Server Fault or respective owner

Related posts about apache2

Related posts about centos6