I have set up port forwarding to point to my works webserver so that selected users can access a site via our external IP address when off site. The forwarding to the server works, but on this server there are several Configs, and at the moment it is just stopping at the first one, so the wrong website is shown.
For example, take these two configs, and our external IP address is
22.214.171.124 - what I would like to be able to do is go to
http://126.96.36.199:789 (random port, can be any) and have the website in Config 1 show. However, the website in Config 2 is showing, because it comes first alphabetically in the list of configs. Is there a way (similar to the ServerAlias) that I can check which port has been accessed and use the corrisponding config?
Listen *:789 NameVirtualHost *:80 NameVirtualHost *:789 <VirtualHost *:80 *.789> ServerName test.dynedrewett.com DocumentRoot /var/www/html/website/test ErrorLog /var/log/httpd/test.dynedrewett.com-error CustomLog /var/log/httpd/test.dynedrewett.com-access combined ErrorDocument 401 /wp-content/themes/dyne_drewett/401.php </VirtualHost>
<VirtualHost *:80> ServerName dummy.dynedrewett.com ServerAlias dummy DocumentRoot /var/www/html/intranet/intranet_test ErrorLog /var/log/httpd/dummy.dynedrewett.com-error CustomLog /var/log/httpd/dummy.dynedrewett.com-access combined ErrorDocument 403 /wp-content/themes/dyne_drewnett/403.php </VirtualHost>
Is there away I can amend the configs so that the correct website is shown when doing this? Thanks.