0
votes

I've configured 2 virtual hosts on my server (servername.dyndns.org). How can I access it from outside LAN?

This is my configuration:

1st Virtual Host

<VirtualHost *:80>
   ServerName website1.local
   DocumentRoot /var/www/website1
   DirectoryIndex index.html index.php
   <Directory "/var/www/website1">
       AllowOverride All
       Allow from All
    </Directory>
</VirtualHost>

2nd Virtual Host

<VirtualHost *:80>
   ServerName website2.local
   DocumentRoot /var/www/website2
   DirectoryIndex index.html index.php
   <Directory "/var/www/website2">
       AllowOverride All
       Allow from All
    </Directory>
</VirtualHost>

File Hosts

127.0.0.1   localhost 
127.0.0.1   website1.local
127.0.0.1   website2.local

Inside LAN, I can access single virtual host digiting website1.local or website2.local. Outside, if I digit servername.dyndns.org, I reach the default welcome index of apache or the last in the hosts file!

Thanks.

1
What URLs are you using to reach those servers from outside of LAN? - Sergey Brodin
servername.dyndns.org, but I reach only the apache default index page! - Nello Sorrentino

1 Answers

0
votes

You have to configure /etc/hosts or /Windows/system32/drivers/etc/hosts on your client computer to reach those virtual hosts:
<server-ip> website1.local
<server-ip> website2.local