Apache2 VirtualHost on Debian not working
Posted
by
milo5b
on Server Fault
See other posts from Server Fault
or by milo5b
Published on 2012-10-13T15:43:32Z
Indexed on
2012/11/19
23:07 UTC
Read the original article
Hit count: 360
I am having some problems with Apache2 configuration. I have already tried to look for documentation on the web (Apache's site, Debian's site, here on serverfault, etc), but nothing really helps.
I have tried different configurations, but my current configuration is the following (/etc/apache2/sites-available/default):
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mysite.dev
ServerAlias mysite.dev
DocumentRoot /var/www/mysite.dev/httpdocs/
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName livesite.com
ServerAlias www.livesite.com
DocumentRoot /var/www/livesite.com/httpdocs/
<Directory /var/www/livesite.com/httpdocs/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
mysite.dev it's just an entry in hosts file on my client machine, while livesite.com it's an actual DNS record which would resolve to the same IP as the IP set in hosts file for mysite.dev.
The problem is that when i try to type mysite.dev in my browser, it would automatically go to livesite.com.
I tried to have different /etc/apache2/sites-enabled/ files (/etc/apache2/sites-enabled/mysite.dev , /etc/apache2/sites-enabled/livesite.com ) - and of course with the actual sites-available related files, but achieving the same results. I have tried to have a peak on error.log and access.log but there's nothing I can see.
My httpd.conf contains:
AccessFileName .htaccess
And I have no /etc/apache2/conf.d/virtual.conf file.
Any help would be greatly appreciated - if I did not provide enough info please let me know I will do my best to provide all necessary info.
Thanks
© Server Fault or respective owner