Forward URL to local private IP

hello all,
currently I have the following problem:
I use MiaB as DNS server and have only one public IP.
Now I have several web servers that I would like to reach via port 80 and 443. The webservers should be reachable under the domain example.com and example2.com. As mailserver for these domains I want to run MiaB. This works without problems. How do I forward the requests to the website example.com and example2.com to the web servers with a private IP in my local network?

Best regards
Syc0nd

I think this is not so much a question for MIAB but more so for your firewall.

If you have one private IP address you have only one port 80 on that IP. Multiple (web)hosts running for separate domains behind the same IP address and port should still be possible with something called ‘reverse proxy’. This runs on your firewall. If you happen to use pfSense there are howto’s around.

1 Like

Can’t I also run the reverse proxy over nginx from MiaB ?

Most changes you make to the nginx configuration on MIAB will get overwritten when MIAB is updated.

You can make changes to nginx that as long as they do not conflict with the MiaB configuration will not get overwritten. There is more than one way to accomplish this, such as creating a virtual server file in /etc/nginx/sites-available and symlink to it from /etc/nginx/sites-enabled or putting a configuration file in /etc/nginx/conf.d/*.conf, but to me the bigger deal is converting a mail server into a reverse proxy, which I’m not sure you could use the reverse proxy as you would need it, but I have limited reverse proxy experience.

A better alternative is to install a network gateway with a tool such as pfSense. You can convert any old 64-bit computer that accepts a PCI/PCIe networking card into an amazingly powerful gateway.

is the /etc/nginx/conf.d/local.conf only overwritten during an update ? Or in regular intervals ?

You probably should make your own file, which is why I specified /etc/nginx/conf.d/*.conf, which is based on include directives in nginx.conf:

$ grep include /etc/nginx/nginx.conf 
include /etc/nginx/modules-enabled/*.conf;
	include /etc/nginx/mime.types;
	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

I have now done it via the custom_yaml hidden function and it works without problems.

Information about this can be found at: Allow configuration of web redirects · Issue #608 · mail-in-a-box/mailinabox · GitHub

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.