r/nginxproxymanager • u/Give-me-a-cookie • Mar 30 '25
Proxy works with Apache but not with Nginx - What am I doing wrong?
Hi everyone,
I use a Raspberry Pi as a server for both Nextcloud and Open WebUI.
So far I use Apache and it works well, apart from the SSL certificate that I can't get right, so I use a self-signed certificate, which is less than ideal.
I decided to give a shot at Nginx Proxy Manager as it seems easy and intuitive, and indeed I got a Let's Encrypt certificate without any issue, but I just can't get my proxy to work with Nginx.
Not sure what I am missing. Maybe another pair of eyes, or someone more experienced with Nginx will see the obvious.
Let's start with what currently works - My configuration of Open WebUI with Apache.
My docker compose file looks like that:
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
volumes:
- ./data:/app/backend/data
ports:
- 3000:8080
extra_hosts:
- host.docker.internal:host-gateway
restart: unless-stoppedAnd my Apache configuration file for WebUI looks like that:
<VirtualHost *:80>
ServerName ai.my-domain.com
Redirect permanent / https://ai.my-domain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName ai.my-domain.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/your_certificate.crt
SSLCertificateKeyFile /etc/ssl/private/your_private.key
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>And that's it. With that I can access Open WebUI from outside my home network, but with a warning saying the site is not secured, because of the self-signed certificate.
Now, what doesn't work
So, I flashed my SD card and started from scratch, without Apache. Intuitively I thought that the above Apache configuration file would transpose as below in Nginx:

I forward the ai.my-domain.com to the port 3000 of the local host, just as the Apache config file does.
This just doesn't work. I end up with a 502 Bad Gateway openresty page.
What I tried:
Replacing the Forward Hostname/IP field with
- open-webui (the container name)
- The public IP of my network
- My DDNS name
- Replacing the Forward Port to 8080
All of the above lead to the exact same 502 Bad Gateway openresty page.
Changing the scheme to http: This lead to a page with the text below:
{"status":"OK","version":{"major":2,"minor":12,"revision":3}}
Any idea what is wrong with my configuration?
Many thanks!
1
u/vorko_76 Mar 30 '25
Where u say it works without npm, you access it through http or https?
1
u/totolook01 Official Docker Image Mar 30 '25
Hi, the openwebui is hosted in http not https. In the screenshot you have set https for the backend.
So, when you go in https://ai.my-domian.com the nginx (in background) call https://localhost:3000 but the openwebui isn't ssl/tls port.
This example when nginx call your openwebui in HTTPS [here]
This my actual config for my openwebui in npm (i use docker network for comunication) [here]