Weird Nginx Error???
from selfhostingperson@sh.itjust.works to selfhosted@lemmy.world on 26 Feb 16:00
https://sh.itjust.works/post/33467342

Good morning/night/evening/the time for you right now, ever since I set up Snikket, my web pages other than Snikket’s have been displaying nginx 404 not found errors. I can access the website locally but when I go to the domain name it pops up the error. When I go to localhost:443 it also shows the nginx not found 404 thing so I think that’s where my other website pages are getting the error from, but I never port fowarded port 443, at least I don’t think so. I use the standard nginx reverse proxy for Snikket, and Nginx Proxy Manager for my other web pages. I really hope someone can help me. Thank you very much in advance.

#selfhosted

threaded - newest

JASN_DE@feddit.org on 26 Feb 16:11 next collapse

Post more logs/configs

selfhostingperson@sh.itjust.works on 26 Feb 16:42 collapse

What kind of logs should I post?

eager_eagle@lemmy.world on 26 Feb 16:23 next collapse

find out which process is really binding to 443 if you don’t recognize that port as being used

sudo ss -unapt | grep 443
selfhostingperson@sh.itjust.works on 26 Feb 16:42 collapse

tcp   LISTEN    0      4096                                     0.0.0.0:9443                   0.0.0.0:*     users:(("docker-proxy",pid=1550,fd=4))                                                                                                             tcp   LISTEN    0      511                                      0.0.0.0:443                    0.0.0.0:*     users:(("nginx",pid=2511847,fd=6),("nginx",pid=2511846,fd=6),("nginx",pid=2511845,fd=6),("nginx",pid=2511844,fd=6),("nginx",pid=2511843,fd=6))     tcp   LISTEN    0      511                                      0.0.0.0:5443                   0.0.0.0:*     users:(("nginx",pid=2540528,fd=6),("nginx",pid=2540399,fd=6))                                                                                      tcp   LAST-ACK  0      1                                  192.168.0.107:443               91.84.87.137:40016                                                                                                                                                    tcp   LISTEN    0      4096                                        [::]:9443                      [::]:*     users:(("docker-proxy",pid=1560,fd=4))                                                                                                             tcp   LISTEN    0      511                                         [::]:443                       [::]:*     users:(("nginx",pid=2511847,fd=5),("nginx",pid=2511846,fd=5),("nginx",pid=2511845,fd=5),("nginx",pid=2511844,fd=5),("nginx",pid=2511843,fd=5))     tcp   LISTEN    0      511                                         [::]:5443                      [::]:*     users:(("nginx",pid=2540528,fd=7),("nginx",pid=2540399,fd=7))

I don’t know how to even interpret this, I know it says nginx but which nginx?? I got like 4 nginx web servers running

catloaf@lemm.ee on 26 Feb 17:36 next collapse

You’ll have to look by pid or command line.

eager_eagle@lemmy.world on 26 Feb 17:48 collapse

you do have an nginx process with PID 2511847 using the port

get more info with

ps aux | grep 2511847

or kill it, if you need to spawn a new one with the right configuration

selfhostingperson@sh.itjust.works on 26 Feb 17:54 collapse

apparently it’s my native nginx… wtf. I used

sudo systemctl stop nginx

And the websites that had the nginx error went down. I don’t know how this could even happen? My containers use their own nginxes??? Maybe the mix of native nginx and docker nginx is messing everything up, if I can’t find a solution I’m probably gonna nuke my native nginx and use docker nginx for all of my nginx needs

JASN_DE@feddit.org on 26 Feb 17:08 collapse

The ones from the applications which should do the proxying and serving.

BTW: you’re using both Nginx Proxy Manager and Nginx in parallel? Native installations, docker, something else?

How are they configured?

selfhostingperson@sh.itjust.works on 26 Feb 17:26 collapse

nginx proxy manager’s in a docker container reverse proxying my nginx docker containers, and native nginx is reverse proxying snikket container because nginx proxy manager doesn’t go well with snikket.

Here’s the nginx config for my snikket.

server {                                                          # Accept HTTP connections                                       listen 80;
  listen [::]:80;

  server_name chat.allinuxuser.xyz;
  server_name groups.chat.allinuxuser.xyz;
  server_name share.chat.allinuxuser.xyz;
                                                                  location / {                                                        proxy_pass http://localhost:5080/;                              proxy_set_header      Host              $host;
      proxy_set_header      X-Forwarded-For   $proxy_add_x_forwarded_for;
                                                                      # This is the maximum size of uploaded files in Snikket
      client_max_body_size 104857616; # 100MB + 16 bytes          }
}                                                                                                                               server {                                                          # Accept HTTPS connections
  listen [::]:443 ssl;                                            listen 443 ssl;
  ssl_certificate /etc/letsencrypt/live/allinuxuser.xyz-0001/fullchain.pem;                                                       ssl_certificate_key /etc/letsencrypt/live/allinuxuser.xyz-0001/privkey.pem;
                                                                  server_name chat.allinuxuser.xyz;                               server_name groups.chat.allinuxuser.xyz;
  server_name share.chat.allinuxuser.xyz;                       
  location / {
      proxy_pass https://localhost:5443/;
      proxy_set_header      Host              $host;
      proxy_set_header      X-Forwarded-For   $proxy_add_x_forwarded_for;
      # REMOVE THIS IF YOU CHANGE `localhost` TO ANYTHING ELSE ABOVE
      proxy_ssl_verify      off;
      proxy_set_header      X-Forwarded-Proto https;
      proxy_ssl_server_name on;

      # This is the maximum size of uploaded files in Snikket
      client_max_body_size 104857616; # 100MB + 16 bytes

      # For BOSH and WebSockets
      proxy_set_header Connection $http_connection;
      proxy_set_header Upgrade $http_upgrade;
      proxy_read_timeout 900s;

  }
}

Here’s the docker-compose for one of the sites i’m running that’s been affected by the weird nginx error.

version: "3"                                                    services:
    client:                                                           image: nginx
      restart: unless-stopped                                         ports:
            - 5973:80                                                 volumes:
            - ./allinuxuser-website:/usr/share/nginx/html

Please tell me if there’s any more logs I need to provide.

JASN_DE@feddit.org on 26 Feb 17:53 collapse

So your native nginx process covers ports 80 and 443. which ports does your NPM use? Are you trying to use the same ports? Because that’ll most likely clash.

selfhostingperson@sh.itjust.works on 26 Feb 17:58 collapse

services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'                        restart: unless-stopped
    ports:                                                            - '325:80'
      - '81:81'                                                       - '326:443'
    volumes:                                                          - ./data:/data                                                  - ./letsencrypt:/etc/letsencrypt

I mean I got them portmapped to other ports so… I dunno