title: Nginx- 98: Address already in use, Failed to bind to ports 433 and 80
body: <p>I have no idea what to do, I killed everything using ports 443 and 80, renewed all my SSL certificates.
  <em>first time I've posted on StackOverflow and very stressed out</em></p>
  
  <p>Things I've tried/followed:<a href="https://bobcares.com/blog/nginx-emerg-bind-to-failed-98-address-already-in-use-in/" rel="nofollow noreferrer">Link 1</a>, <a href="https://stackoverflow.com/questions/14972792/nginx-nginx-emerg-bind-to-80-failed-98-address-already-in-use">Link 2</a>, <a href="https://www.digitalocean.com/community/questions/nginx-is-unable-to-bind-to-443" rel="nofollow noreferrer">Link 3</a></p>
  
  <pre><code>server@engtoast:/etc/nginx/sites-available$ sudo netstat -tulpn | grep --color :443
  tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      5191/nginx: master
  tcp6       0      0 :::443                  :::*                    LISTEN      5191/nginx: master
  server@engtoast:/etc/nginx/sites-available$ sudo netstat -tulpn | grep --color :80
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5191/nginx: master
  tcp6       0      0 :::80                   :::*                    LISTEN      5191/nginx: master
  server@engtoast:/etc/nginx/sites-available$ sudo nginx
  nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
  nginx: [emerg] still could not bind()
  server@engtoast:/etc/nginx/sites-available$  
  
  server@engtoast:/etc/nginx/sites-available$ sudo netstat -ltnp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1218/systemd-resolv
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2345/sshd
  tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      5730/cupsd
  tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      6853/nginx: master
  tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      2445/smbd
  tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      2291/mysqld
  tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      2445/smbd
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      6853/nginx: master
  tcp6       0      0 :::22                   :::*                    LISTEN      2345/sshd
  tcp6       0      0 ::1:3350                :::*                    LISTEN      2024/xrdp-sesman
  tcp6       0      0 ::1:631                 :::*                    LISTEN      5730/cupsd
  tcp6       0      0 :::443                  :::*                    LISTEN      6853/nginx: master
  tcp6       0      0 :::3389                 :::*                    LISTEN      2456/xrdp
  tcp6       0      0 :::445                  :::*                    LISTEN      2445/smbd
  tcp6       0      0 :::139                  :::*                    LISTEN      2445/smbd
  tcp6       0      0 :::80                   :::*                    LISTEN      6853/nginx: master
  </code></pre>