Not exactly sure how to ask the question so please correct my flaws. I want to create two separate http web processing environments on a debian box for web development. Right now everything is processed in /var/www and I access it at http://localhost. I need a second location that works exactly like /var/www , but is independent so I can work with a different .htaccess file. How can I configure apache2 to use a new location, and then what address do I use to access it?
2 Answers
As usual, there are many ways to achieve this.
One way would be to create a subfolder (either beneath /var/www or anywhere else) to hold all the files. Then copy /etc/apache2/sites-available/default to /etc/apache2/sites-available/newname and edit it. Set the Servername to whatever you want it to be, and point the DocumentRoot to the new folder you created. Next, enable the new site by running a2ensite newname
. Now add the ServerName for your new site to /etc/hosts in a line that either has 127.0.0.1 or your actual IP address in it (this makes sure that you don't need DNS to resolve the sitename). Now open a browser and type in http://ServerName, and you should get the new site. The apache logs can be used to confirm what you are actually getting.

- 8,847
- 3
- 30
- 34
-
Thanks, it worked! The only extra step I had to take was to reload apache2: /etc/init.d/apache2 reload – JMC Sep 18 '10 at 19:24
-
Sorry, forgot that. But you figured it out anyway. – wolfgangsz Sep 18 '10 at 19:35
You could create a second name-based virtual host, add its ServerName
to your /etc/hosts
and set AccessFilename to another value inside the <VirtualHost>
container.

- 21,387
- 3
- 47
- 50