homepage Welcome to WebmasterWorld Guest from 23.22.173.58
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
jasontheadams




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

Greetings!

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
</Directory>
ErrorLog /var/log/apache2/example-error.log
</VirtualHost>


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

127.0.0.1 example.com

As far as I can tell, it's this simple. Am I missing something?

 

phranque




msg:4649524
 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)

jasontheadams




msg:4649736
 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.

Thanks!

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