FYI: Recently we had an issue configuring virtual hosting on Apache, we found lots of useless information and very little relevant but vague information on the subject. Here's the facts!
Issue: URL not accessible from within the network, local ip directs to wrong folder and localhost directs to the right folder.
Solution: Check your vhosts configuration, in Suse 10.x httpd.conf includes your configuration files to keep things easy to maintain, you'll find listen.conf in
/etc/apache2 and your vhosts.conf files in
/etc/apache2/vhosts.d; Make sure you have the following configured correctly for named virtual hosting in your listen.conf file:
Listen 80and at the bottom of the file
NameVirtualHost *both these lines should be uncommented!
Your vhost.conf file should look something like this working example:
# DERFAULT.COM
<VirtualHost *>
ServerName default.com
DocumentRoot /srv/www/htdocs
ServerAdmin you@yourdomain.com
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
<IfModule mod_userdir.c>
UserDir public_html
Include /etc/apache2/mod_userdir.conf
</IfModule>
<Directory "/srv/www/htdocs">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# OTHER.COM
<VirtualHost *>
ServerName other.com
DocumentRoot /srv/www/vhosts/other.com
ServerAdmin you@yourdomain.com
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
<Directory "/srv/www/vhosts/other.com">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
You can also create a seperate .conf file for each VirtualHost, all .conf files will be included from your
vhosts.d directory. Keeping VirtualHost files seperated makes it easier to administer changes on a single domain.
Make sure you correctly set up your DNS or DynDNS to point to your external IP Address and if you are using a router, set up port forwarding to your local machine and check that
"Filter Internet NAT Redirection" is
NOT ticked under your router security settings.
Restart Apache services and everything should work!