0

There was an old topic from me, I thought I solved it but sadly not.

So when I try to bind port 80 on any of my domains that error comes and NGINX won't start:

nginx[1950005]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)

My example.com config:

server {
listen 80;
  server_name sub.example.com; #Change this to your domain name
}



server {
  listen 443 ssl http2;
  server_name sub.example.com; #Change this to your domain name
    ssl_certificate /etc/letsencrypt/live/sub.example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sub.example.com/privkey.pem; # managed by Certbot

  ssl_dhparam /etc/ssl/certs/dhparam.pem;

  # Allow large attachments
  client_max_body_size 128M;

  location / {
    proxy_pass http://0.0.0.0:8080;
    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;
  }

  location /notifications/hub {
    proxy_pass http://0.0.0.0:3012;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

  location /notifications/hub/negotiate {
    proxy_pass http://0.0.0.0:8080;
  }

location ~ /.well-known/acme-challenge/ {
    allow all;
}
}

If I comment the port 80 out, everything works. BUT I cannot renew my certificates because certbot respectively letsencrypt tries to connect to my server with port 80 and gets a 500.

` curl -i sub.example.com

HTTP/1.1 500 Internal Server Error Server: nginx/1.22.0 Date: Tue, 27 Jun 2023 14:05:38 GMT

Internal Server Error `

I tried to change the "listen 80;" to other syntaxes but nothing worked.

Rebooted the system.

netstat -pant | grep 80 output:

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3366/nginx: master

ps -ef | grep nginx | grep -v grep output:

root        3366       1  0 Jun24 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
www-data    3367    3366  0 Jun24 ?        00:00:00 nginx: worker process
www-data    3368    3366  0 Jun24 ?        00:00:01 nginx: worker process
www-data    3369    3366  0 Jun24 ?        00:00:00 nginx: worker process
www-data    3370    3366  0 Jun24 ?        00:00:00 nginx: worker process
www-data    3371    3366  0 Jun24 ?        00:00:04 nginx: cache manager process

0 Answers0