For everyone interested in homelabs, or anyone who likes to run their local development environment with an SSL certificate, here is a handy snippet. If you want to access an Apache instance through NGINX Proxy Manager, the default configuration means the pages do not want to load, and after a while the error message ERR_TOO_MANY_REDIRECTS appears. The reason is that the header information is not forwarded to Apache. If there are further technical subtleties that cause the error, feel free to email me and I will extend this article accordingly.
There are basically two approaches.
“Quick and dirty”:
If you run PHP projects, the following server variable has to be set for each project:
$_SERVER['HTTPS'] = 'On';
That is all, and the page in question should load. This solution is of course not very pretty, and this piece of code would be unsightly especially if you want to publish the site later.
“Normal Mode”
In NGINX Proxy Manager, place the following lines under Advanced in the entry that points to your Apache server:
proxy_read_timeout 300;
proxy_pass_header X-Transmission-Session-Id;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
On your server, you now enable the Apache extension mod_remoteip with the following command:
sudo a2enmod remoteip
Now open your vHost config file (it should be located in /etc/apache2/sites-enabled/) and add the following information. The important part is the section between the two hash symbols:
<VirtualHost *:80>
#
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy ip.eures.proxy.managers
SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
#
</VirtualHost>
Then we reload our config with the following command.
sudo systemctl reload apache2.service
That’s it, now it should work.




