The_Ben on Nostr: If your container opens a port to the outside, then you can use an Nginx proxy to ...
If your container opens a port to the outside, then you can use an Nginx proxy to serve this port from 127.0.0.1 on a domain.
In this example here, a Haven relay is running on port 3355 in a Docker container. The port is exposed to the outside. My Nginx server then serves this port with SSL and a domain.
location / {
proxy_pass
http://127.0.0.1:3355;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Let me get a full example.....
Published at
2024-11-01 20:57:10Event JSON
{
"id": "780d3fd447d663e62e86bb558043fb0261198f85302b7352d1a42ac080f727f7",
"pubkey": "0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033",
"created_at": 1730494630,
"kind": 1,
"tags": [
[
"client",
"gossip"
],
[
"p",
"a39d19ec238af1b14b8cf36185a933b141f994e2ff7a1323a4cbb65f3d88f61e"
],
[
"e",
"3465e1e9760f7e248dbcb33825941987f3c8ff445b5ce37891c60e80fdd80fbf",
"wss://nos.lol/",
"root"
]
],
"content": "If your container opens a port to the outside, then you can use an Nginx proxy to serve this port from 127.0.0.1 on a domain.\n\nIn this example here, a Haven relay is running on port 3355 in a Docker container. The port is exposed to the outside. My Nginx server then serves this port with SSL and a domain.\n\nlocation / {\n proxy_pass http://127.0.0.1:3355;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection \"upgrade\";\n }\n\nLet me get a full example.....",
"sig": "01998a0bc874ba129a6c3e1c0e2a548e11c69a1477d4f9011b48cfcbb803aca0350821edbbb905635b904095c38891fa486721c1ef481c941fa522f67ec00c23"
}