1

we are using Apache2 to host multiple sites on one system in our local network. One such site is the following:

<VirtualHost *:80>
    ServerName wiki.idi.local
    DocumentRoot /srv/dokuwiki/engineering
</VirtualHost>

On our local DNS server we forward the address wiki.idi.local to the PC hosting the site and everything works as expected.

Since this week we have obtained a way to access our local network from outside by mapping local IP addresses to an external one (redirect through a proxy). So for example address 3.205.151.6 (external) is redirected to 172.16.1.6 (internal). This worked fine for the sites where in the VirtualHost the DocumentRoot would be localhost:port. In this case we can simply call 3.205.151.6:port to access our systems. The problem is that in the case mentioned above I can't find a way to access the site through IP only. Is there any way to do this without having access to the proxy that does the forwarding?

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Mircea M
  • 113
  • 2

1 Answers1

1

What you probably want is to setup views in your DNS software so DNS queries from internet get replied with public IP address and DNS queries from local network get responded to with private IP. For more info check this link for instance

On Apache side you need to add some public name since domain with .local is not resolvable. So let's say you own domain idi.com you could update your VirtualHost with something like

<VirtualHost *:80>
    ServerName wiki.idi.local
    ServerAlias wiki.idi.com
    DocumentRoot /srv/dokuwiki/engineering
</VirtualHost>

And make sure your public DNS view for wiki.idi.com responds with IP 3.205.151.6 and possibly you could setup private DNS view for same wiki.idi.com to answer with 172.16.1.6 and you would not need domain wiki.idi.local at all.

Hrvoje Špoljar
  • 5,245
  • 26
  • 42
  • Is there any way to access the site without a public name? I only have access to the local DNS (in our internal network), not the public one. Can the site be accessed by using 3.205.151.6/ in some way? – Mircea M Nov 12 '14 at 10:57
  • You could add wiki.idi.local to hosts of system and access it from internet; since resolving would be done by using hosts entry and not DNS. Other than that you could access domain by accessing IP directly, but you need to make sure this domain is default domain that is served; check output of apache2ctl -S for details on that – Hrvoje Špoljar Nov 12 '14 at 11:07
  • Hi, thanks for the idea. I changed the default domain so that it points to the site. Now accessing the IP will directly open the needed site. Thanks! – Mircea M Nov 12 '14 at 11:58