Welcome to Incremental Social! Learn more about this project here!
Check out lemmyverse to find more communities to join from here!

[solved] Nginx proxy server - strange behavior

Hello fellow selfhosters! I changed my server OS from fedora server to alma linux as I wanted a more stable base with less frequent updates for my docker containers, so I backed everything up and installed almalinux. It all went smoothly, and now all the containers seem to work as before except for nginx proxy manager: on fedora, I set all the proxy hosts like this (using jellyfin for instance):
jellyfin.mydomain.duckdns.org > http://myserverhostname:8096
now, for some strange reasons, it does not work anymore, and I get a bad gateway error. I tried with and without SSL (that I had from the previous installation, do I need to regenerate them? but without it should work anyway...), pointing to localhost:8096, to myserverhostname:8096, to jellyfin:8096, but nothing. The only way I could make it work was with the resolved IP address of my server:

# host myserverhostname
myserverhostname.station has address 192.168.1.13

pointing nginx to 192.168.1.13:8096 correctly shows the website. why does this happens? am I doing something wrong?

EDIT: the only one that's working with localhost is nginx itself (http://localhost:81)

======

SOLUTION: instead of myserverhostname, in nginx proxy host configuration (in the gui) I had to set myserverhostname.station to get it working. I don't know why, in the previous installation only the hostname was enough...

Decronym Bot , (edited )

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
HTTP Hypertext Transfer Protocol, the Web
SSL Secure Sockets Layer, for transparent encryption
nginx Popular HTTP server

2 acronyms in this thread; the most compressed thread commented on today has 10 acronyms.

[Thread for this sub, first seen 28th Jan 2024, 18:55]
[FAQ] [Full list] [Contact] [Source code]

Oisteink ,

As you can forward by ip but not by name it sounds like resolver issue.

tubbadu OP ,

how can I find out more about this?

Oisteink ,

On the host of the nginx rev proxy or in nginx config files.
Something seems to block the lookup from name to ip, as ip works you know the proxy works.
Check dns config and nginx config on that host

tubbadu OP ,

on the server host myserverhostname correctly resolves, but if I enter the container (docker exec -it nginx-app-1 bash) it does not work anymore:

[root@docker-11e3869f946f:/app]# host tserver
Host tserver not found: 3(NXDOMAIN)

(I had to install dnsutils before)

it seems a nginx issue then

Oisteink ,

Could also be docker network-config.
Docker should by default use the hosts resolver config if there’s nothing in /etc/resolve.conf

You can also supply dns server on the docker command or in your compose file if you’re using compose.

As a last resort you can enter server and ip i the container’s /ets/host file if the ip is static. But that’s gone once you rebuild the image.

Or maybe there’s env on the container you use for dns

tubbadu OP ,

I found a solution: use myserverhostname.station instead of just the hostname. I really have no idea why, on the previous installation it worked well with just the hostname... ahh, whatever.

thank you very much for the help!

tubbadu OP ,

here's the configuration file for jellyfin:

# ------------------------------------------------------------
# jellyfin.tubbadu.duckdns.org
# ------------------------------------------------------------



map $scheme $hsts_header {
https   "max-age=63072000; preload";
}

server {
set $forward_scheme http;
set $server         "192.168.1.13";
set $port           8096;

listen 80;
listen [::]:80;

listen 443 ssl;
listen [::]:443 ssl;


server_name jellyfin.tubbadu.duckdns.org;


# Let's Encrypt SSL
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
ssl_certificate /etc/letsencrypt/live/npm-18/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-18/privkey.pem;






# Block Exploits
include conf.d/include/block-exploits.conf;








proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;


access_log /data/logs/proxy-host-5_access.log proxy;
error_log /data/logs/proxy-host-5_error.log warn;







location / {








proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;


# Proxy!
include conf.d/include/proxy.conf;
}


# Custom
include /data/nginx/custom/server_proxy[.]conf;
}
  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • random
  • incremental_games
  • meta
  • All magazines