Below is my /etc/apache2/sites_available/default file.
I have pointed mysite.com to localhost in /etc/hosts and the website works fine when accessed from the same machine it's running on.
However, if I get a second machine, edit its /etc/hosts and point mysite.com to the first machine, then apache only serves up a generic Not Found: The requested URL / was not found on this server
message. (I get the exact same message if I navigate to http://127.0.0.1 on the first machine instead of using the name mysite.com) Nothing is put into access.log or error.log but there is something in other_vhosts_access.log
Why is this happening and how do I fix it? Also, when I kick Apache it says NameVirtualHost *:80 has no VirtualHosts
, in case that's relevant.
Here's the config file:
<VirtualHost mysite.com:80>
ServerName mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /var/www/mysite.com/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mysite.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/mysite.com.error.log
CustomLog ${APACHE_LOG_DIR}/mysite.com.access.log combined
</VirtualHost>
I believe your issue is in your <VirtualHost mysite.com:80>
. I would try <VirtualHost *:80>
.
If I recall correctly, that spot is supposed to be the IP the traffic is coming in on. I just know that I always use '*' or the static IP of the server in that spot when I configure my web servers.