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?


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

for the other file nano www.someaddress.lan

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

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

and restart apache you should be good

  • I use ubuntu dist – J.Olufsen 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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