Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to point someaddress.lan to default apache page and www.someaddress.lan to /var/www/wordpress/? Should I modify this file /etc/apache2/sites-available/default/etc/apache2/sites-available/default or place some symlinks in default apache dir? What is the right way?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The right way is to use separate virtualhosts for each one of them. The exact method would depend on your distribution - debian uses a slightly different workflow.

Ubuntu has a nice guide here but i'll simplify it a little based off here

You need to create two files in /etc/apache2/sites-available

The names can be arbitrary but someaddress.lan and www.someaddress.lan would work

To do this, nano someaddress.lan

paste in the following

<VirtualHost *>
  ServerName someaddress.lan
  DocumentRoot /var/www
</VirtualHost>

for the other file nano www.someaddress.lan

<VirtualHost *>
  ServerName www.someaddress.lan
  DocumentRoot /var/www/wordpress
</VirtualHost

run a2ensite someaddress.lan and a2ensite www.someaddress.lan

and restart apache you should be good

share|improve this answer
    
I use ubuntu dist –  RCola Apr 8 '12 at 15:04
1  
@RCola: Ubuntu is based on Debian, and thus inherits more or less all its workflows. EDIT: I skip the rest of my Debian/Ubuntu centric comment since the answer was simultaneously updated with the same info :-) . –  Daniel Andersson Apr 8 '12 at 15:16
1  
Yes. If he was running RHEL it would require symlinking i believe. –  Journeyman Geek Apr 8 '12 at 15:19

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.