this post was submitted on 12 Oct 2023
0 points (50.0% liked)

Self-Hosted Main

502 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

For Example

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

founded 1 year ago
MODERATORS
 

I'm running a VPS on Oracle

My domain is managed by Cloudflare

I installed nginx reverse proxy manager in a Docker container with the following ports:

180:80
181:81
1443:443

I port forwarded ports 180 and 1443, and I get the following message when going to PublicIP:180

Congratulations!
You've successfully started the Nginx Proxy Manager.

If you're seeing this site then you're trying to access a host that isn't set up yet.

Log in to the Admin panel to get started.

I installed an nginx server to serve as the test container, and I've added both the NPM and the nginx server to the same network in Docker.

I get the following when accessing the nginx server (http://10.11.0.1:7676) via the said network:

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

In Cloudflare, I set 2 A records, both of them unproxied:

mydomain.com         to     MyPublicIP
test.mydomain.com    to     MyPublicIP

and I've also tried setting a CNAME for the test.mydomain.com and pointing it to root with no luck.

When I ping mydomain.com, I can see my public IP.

In NPM, I have the following settings:

Domain Name: test.mydomain.com
Scheme: http
Forward Hostname: 10.11.0.1
Forward Port: 7676
Block Common Exploits: True

When I try visiting http://test.mydomain.com from multiple browsers and 2 different networks, I get nothing.

Also, I tried getting an SSL certificate but was met with an error, and now it looks like I've hit the hourly limit on that...so I'm at least trying to get http working while I wait.

This is my first time trying NPM out, what am I missing? Help!

Thanks!

top 2 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 11 months ago

The docs are pretty straightforward

https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

Here's a barebones of what my nginx.conf looks like to do a reverse proxy

worker_processes 1;

error_log nginx_error.log;

events { worker_connections 1024; }

http { server { server_name mydomain.com www.mydomain.com; location / { proxy_pass http://localhost:9000; } listen 80; }

but if you're running nginx inside a docker container you also need to expose the port in the container with -p flag. So your run command is something like docker run ... -p 80:80

[–] [email protected] 1 points 11 months ago
Forward Hostname: 10.11.0.1
Forward Port: 7676

Since you mention that both NPM and nginx are in the same Docker network, you need to point NPM to the internal port of nginx. Not the mapped port which is only for the Docker host machine. I would assume your default internal nginx port is 80 and you map that for manual access to 7676. But NPM needs to be pointed at the 80.

In addition you should only use the containernames as hostnames with Docker networking. The 10.11.0.1 is probably your Docker host IP, not the IP of the nginx container itself. And those are dynamic by default.

So change your NPM settings to:

Forward Hostname: nginx
Forward Port: 80

Very basic reverse proxy and Docker network stuff. Btw, /r/Docker and /r/NginxProxyManager both exist.

Also, I tried getting an SSL certificate but was met with an error, and now it looks like I've hit the hourly limit on that...

Cant say anything about the SSL cert error without any details at all. But hitting the hourly Lets Encrypt limit is easily avoidable by simply using the staging CA instead of the live CA, which is the recommended way for doing fresh setups and youre unsure of how it works. Using the LE staging CA you can mess with settings and try stuff out, without getting limited. Once you have everything working, you switch it over to the live CA and then you get a valid cert.