Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Trouble setting up virtual host

7:40 pm on Feb 26, 2014 (gmt 0)

New User

joined:Feb 26, 2014
posts: 6
votes: 0


Important information: Running Apache 2.4.6 on Ubuntu 12.04. I have the vhost_alias module running.

I'm trying to set up a virtual host on my local machine, and for some reason when I go to example.com it routes me to /var/www instead of /var/www/example/wordpress, as I'm hoping it to do.

The following is the configuration in the sites-available folder, which I enable using a2ensite example:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example/wordpress
<Directory /var/www/example/wordpress>
Options Indexes FollowSymLinks Includes
AllowOverride All
Require all granted
ErrorLog /var/log/apache2/example-error.log

I also added the following line to the /etc/hosts file:  example.com

As far as I can tell, it's this simple. Am I missing something?
10:10 pm on Feb 26, 2014 (gmt 0)


WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
votes: 126

is /var/www/example/wordpress a symbolic link by any chance?

check the error log.
you might even get some logging on startup that tells you what apache thinks the document root directory is as opposed to what you think it should be.

you can also try:
apachectl -S
(or the equivalent command in your case)
3:11 pm on Feb 27, 2014 (gmt 0)

New User

joined:Feb 26, 2014
posts: 6
votes: 0

I figured it out. I was improperly restarting Apache.. Oops! There's a huge difference, it seems, between 'service apache2 restart' and '/etc/init.d/apache2 restart'. I did not know that. The latter prompts apache to re-cache the config files.