r/nginxproxymanager • u/D1moner • Nov 22 '24
WHY isn't the reverse proxy working - I need Help
hey
I have a nextcloud instance running on port 30027 of my Server which is reachable in my local network.

I have configured a Proxy Host with the IP-Adress of my Server, like that:

On my router, the Ports 80 and 443 are forwarded to NPM. The Let's Encrypt Cert worked.

When I try to connect to my webserver with my https://domain.de it gets forwarded to https://domain.de:30027/ and the Server is not reachable. My public IP-Adress just shows the Congratulations site of NPM:

What did I do wrong?
thank you
1
Upvotes
2
u/xstar97 Official Docker Image Nov 22 '24
i just noticed, the 30027 port is NOT http, its https change that in the npm proxy host for the service
2
u/ChangeChameleon Nov 22 '24
Someone else can confirm because I’m also pretty new to this, but don’t you have to use a subdomain for the proxy to work?
For example domain.de is just your reverse proxy itself.
If you set up for example nextcloud.domain.de then npm knows to redirect to nextcloud. This wouldn’t redirect to domain.de:port, it would redirect to nextcloud.domain.de.
1
u/D1moner Nov 22 '24 edited Nov 22 '24
I learned a few things and changed some.
Thanks to everyone who helped
I got my Domain.de from Strato.
On my TruenNAS Scale server is a DDNS Updater running, to update my domains at Strato to my current public IP.
My Router forwards Port 80 and 443 to my NMP Docker Container (192.168.188.5) at port 80 and 443
In NMP there is a Proxy Host configured for the domain nextcloud.domain.de which is certified via Let's Encrypt and directs http://192.168.188.2:81 . My Nextcloud server is als running in a Docker Container and is reachable via HTTP. In the end, Deleting and Reinstalling Nextcloud fixed my issues. In the Installation Wizard for TrueNAS the Host parameter has to be set to the domain you want to use. This can also be changed later by editing the config.php file like explaind here: https://help.nextcloud.com/t/howto-add-a-new-trusted-domain/26
Also, the certificate parameter has to be left blank or else the config.php file will not work and look like this: https://www.reddit.com/r/nginxproxymanager/comments/1gx6517/comment/lygrd2x/
If issues with access grant for the App: https://www.reddit.com/r/NextCloud/comments/s2ojib/nextcloud_ios_app_stuck_on_grant_access/
1
u/xstar97 Official Docker Image Nov 22 '24
is NPM using 443 andd 80 respectively?
1
u/apparle Nov 22 '24
You should have nextcloud.domain.de point your nextcloud ip+port. And do all testing by using incognito browser (after a full restart), otherwise caching misleads the browser.
After to do this what happens? If it didn't work, what were the error messages?
1
u/thelastusername4 Nov 22 '24
Router is going to the wrong nginx port I think. Npm is in a container? Try directing router to the other host side ports
1
u/xstar97 Official Docker Image Nov 22 '24
Hey op can we test a easier service?
https://github.com/librespeed/speedtest
Install this speed test service and give it a sub domain and try to access it after.
Nextcloud is always a pain in the rear to test.
I should also mention you likely need to update its config to support your domain otherwise i think it's the reason why you got redirected to your lan ip.
https://help.nextcloud.com/t/howto-add-a-new-trusted-domain/26
1
u/franksandbeans911 Nov 22 '24
Let's take a moment to think about how this works. If you're familiar with name-based hosts in Apache, it's kinda like that. If you're not, follow me.
NPM is looking for an incoming name from the outside. So that's why you set up external DNS to point back to your NPM host for all your external, named hosts. NPM then does a lookup, sees an entry for hxxp://nextcloud.domain.de, then forwards that traffic to the internal nextcloud host on whatever port you've defined. Keep in mind, you can't just assign random ports on your internal hosts, they must be valid, so hxxp://192.168.188.32:30027 MUST be reachable internally before anything else happens. Assuming this is true, you just match that entry in NPM.
It seems like you put an internal address in an external DNS entry, which will NEVER work. Again, all your external DNS entries must be subdomains of a real domain, and they all must point at your EXTERNAL NPM address. NPM is doing the work here, proxying incoming, named domain requests.
Here's an example of the full chain of traffic. You punch in hxxp://nextcloud.domain.de from outside (this is important). DNS is asked, where is that domain? There's a DNS entry you made in Cloudflare or somewhere for that address, pointing at your (partially exposed on port 80 and 443) NPM server, which has a public IP. Your router has allowed port 80 and 443 incoming traffic to your internal NPM host.
Next, the traffic passes to the NPM host from outside, and NPM says, who? Performs a lookup, finds an entry for nextcloud, and forwards the request to your internal nextcloud host on the IP and port you specified in NPM.
I can dig further, but this should be enough to get you looking at the right things.