Apache

Apache VirtualHost – WebServer on Another Port

Just encountered this today. Here is the situation. We are developing a big project that take almost six months to finished. Thus, all our attention are focused on that project. What we did is install the project on our central development server into the web root.

We are almost finished, but suddenly we have another small project that we also need to house on our development server without interfering the other project.

To solve this, I need to create another VirtualHost for a specific port on the same server so that I may write:

http://our-server:8000/

And that would automatically point to our new project. After a quick research, i found this link: http://www.daniweb.com/forums/thread29286.html. I studied it and tried but I think I failed because it says the page is forbidden.

Again, I ask a question in our forum: http://www.phpugph.com/talk/index.php/topic,8029.0.html and gets almost the same answer. However, it made me realized that my first attempt was successful, but it just don’t allow directory browsing.

I pointed my browser directly to the http://our-server:8000/index.htm file and there you go, it works.

This is the final httpd.conf settings:

Listen 10.38.248.109:8000

<VirtualHost 10.38.248.109:8000>
   ServerName 10.38.248.109
   ServerAlias localhost ess21147
   DocumentRoot "C:/www/web_projects"
   DirectoryIndex index.php index.html index.htm
   
   <Directory "C:/www/web_projects">
      AllowOverride All
	  Allow from All
   </Directory>
   
   Alias /projects "C:/www/web_projects"
   <Directory "C:/www/web_projects">
      AllowOverride All
	  Allow from All
   </Directory>
</VirtualHost>

I think the alias there is useless. But I just posted it here since it was my original setup. After some cleanup, of course that settings are changed.

Leave a reply

Your email address will not be published. Required fields are marked *