I would like to enable example.com for public IP [from outside of lan] of the server but in local network I would like to set to this website works under local IP of the server. Currently my vhost file looks like this: Code: <VirtualHost *:80> ServerName example.com ServerAlias www.example.com ServerAdmin [email protected] DocumentRoot /var/www/example/public <Directory /var/www/example/public> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> </VirtualHost> I tried change first line of above to <VirtualHost public_ip:80> but after reload apache it does not work. I also tried create parallel vhost with this same settings as above but with <VirtualHost 192.168.100.202:80> but it also does not work. Currently only set in web browser domain name example.com is opening website. Earlier, when vhost didn't contain ServerName and ServerAlias, website was visible under public IP and local IP (servr has two NICs). Could anybody help?
Since it worked before, why not use it that way? Set up internal name service to return the internal IP, and public name service to return the IP reachable from the Internet. Check Apache listens to both interfaces.