Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.