homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Trouble setting up virtual host

Msg#: 4649478 posted 7:40 pm on Feb 26, 2014 (gmt 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?



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

Msg#: 4649478 posted 10:10 pm on Feb 26, 2014 (gmt 0)

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)


Msg#: 4649478 posted 3:11 pm on Feb 27, 2014 (gmt 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.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved