Question

Nginx Stopped Working after installing Let's Encrypt on Ubuntu 20.04

Posted January 21, 2021 217 views
NginxLet's EncryptUbuntu 20.04

I tried to install Let’s Encrypt on my Ubuntu 20.04 by following this article: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04#step-4-%E2%80%94-obtaining-an-ssl-certificate and after installing Nginx stopped working and I can’t start Nginx anymore.

These are a few of the tests:

#sudo vim /etc/nginx/sites-enabled/mydomain
server {

  server_name domain.com www.domain.com;
#sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
#sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
#sudo ufw status
Status: inactive

and certbot asked me: Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. I selected to redirect. And when I visit my site without https I get 502 Bad Gateway and when I go with https I get domain.com refused to connect.

Any help is appreciated and thanks in advance

1 comment
  • PS: When I run sudo ls -l /etc/letsencrypt/live/mydomain.com/cert.pem I get: lrwxrwxrwx 1 root root 37 Jan 21 10:05 /etc/letsencrypt/live/domain.com/cert.pem -> ../../archive/domain.com/cert1.pem

    And

    #systemctl status nginx
    ● nginx.service - A high performance web server and a reverse proxy server
         Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Thu 2021-01-21 10:25:30 UTC; 18min ago
           Docs: man:nginx(8)
        Process: 201899 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited>
        Process: 201910 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=>
    

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
5 answers

I did sudo fuser -k 80/tcp and did service nginx restart and site is up again.

A big thanks to @bobbyiliev

Hi there,

I could suggest first checking your Nginx error log for some more information on why the service is crashing. You can do that with the following command:

  • sudo tail -100 /var/log/nginx/error.log

Another thing you could do is to run the journalctl -xe as per the output of the Nginx start command.

Feel free to share the errors here.
Regards,
Bobby

Thanks @bobbyiliev for your reply

These are the complete outputs:

#sudo tail -100 /var/log/nginx/error.log
2021/01/21 10:28:55 [crit] 201626#201626: *43 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 128.14.134.170, server: domain.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "206.189.7.79"
2021/01/21 10:29:00 [crit] 201626#201626: *42 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 77.16.221.12, server: domain.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:32:56 [crit] 201626#201626: *47 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.234, server: domain.com, request: "GET /posts/painal-alert-dillion-harper-s-hardcore-anal-sex/s/1 HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:40:08 [crit] 201626#201626: *49 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.234, server: domain.com, request: "GET /posts/young-sexy-teen-nude-yoga/s/2 HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:47:01 [crit] 201626#201626: *51 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /snaps/girl-teasing-boobs-and-playing-with-panties-on HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:47:20 [crit] 201626#201626: *53 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.232, server: domain.com, request: "GET /posts/unbelievable-porn-stars-photos-before-and-after-applying-make-up-part-1/s/2 HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:51:34 [info] 202078#202078: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2021/01/21 10:51:35 [notice] 202081#202081: signal process started
2021/01/21 10:51:35 [error] 202081#202081: invalid PID number "" in "/run/nginx.pid"
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:35 [emerg] 202082#202082: still could not bind()
2021/01/21 10:51:38 [notice] 202083#202083: signal process started
2021/01/21 10:51:38 [error] 202083#202083: invalid PID number "" in "/run/nginx.pid"
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 10:51:38 [emerg] 202084#202084: still could not bind()
2021/01/21 10:52:02 [crit] 201626#201626: *55 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 77.16.221.12, server: domain.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:52:30 [info] 202090#202090: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2021/01/21 10:54:32 [crit] 201626#201626: *58 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /posts/young-sexy-teen-nude-yoga/edit HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 10:54:54 [crit] 201626#201626: *61 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 77.16.221.12, server: domain.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "www.domain.com"
2021/01/21 10:56:50 [crit] 201626#201626: *63 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 77.16.221.12, server: domain.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:01:45 [crit] 201626#201626: *66 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /posts/unbelievable-porn-stars-photos-before-and-after-applying-make-up-part-3/edit HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:01:45 [crit] 201626#201626: *68 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.232, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:08:57 [crit] 201626#201626: *70 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:16:30 [crit] 201626#201626: *72 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 209.141.60.195, server: domain.com, request: "GET /config/getuser?index=0 HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "206.189.7.79:80"
2021/01/21 11:17:14 [crit] 201626#201626: *74 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 83.175.105.76, server: domain.com, request: "GET /snaps/20-years-old-bitch-fucked-in-club-toilet HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com", referrer: "https://www.google.com/"
2021/01/21 11:17:38 [crit] 201626#201626: *76 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:26:20 [crit] 201626#201626: *78 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:28:01 [crit] 201626#201626: *80 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 185.23.230.44, server: domain.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "206.189.7.79:80"
2021/01/21 11:30:33 [crit] 201626#201626: *82 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:37:45 [crit] 201626#201626: *84 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:47:01 [crit] 201626#201626: *86 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 11:59:20 [crit] 201626#201626: *89 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
2021/01/21 12:02:15 [info] 202589#202589: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2021/01/21 12:03:38 [info] 202601#202601: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2021/01/21 12:03:38 [warn] 202601#202601: conflicting server name "domain.com" on [::]:80, ignored
2021/01/21 12:03:38 [warn] 202601#202601: conflicting server name "www.domain.com" on [::]:80, ignored
2021/01/21 12:03:38 [warn] 202616#202616: conflicting server name "domain.com" on [::]:80, ignored
2021/01/21 12:03:38 [warn] 202616#202616: conflicting server name "www.domain.com" on [::]:80, ignored
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:38 [emerg] 202616#202616: still could not bind()
2021/01/21 12:03:53 [info] 202628#202628: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2021/01/21 12:03:53 [warn] 202628#202628: conflicting server name "domain.com" on [::]:80, ignored
2021/01/21 12:03:53 [warn] 202628#202628: conflicting server name "www.domain.com" on [::]:80, ignored
2021/01/21 12:03:53 [warn] 202640#202640: conflicting server name "domain.com" on [::]:80, ignored
2021/01/21 12:03:53 [warn] 202640#202640: conflicting server name "www.domain.com" on [::]:80, ignored
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:03:53 [emerg] 202640#202640: still could not bind()
2021/01/21 12:05:40 [info] 202663#202663: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2021/01/21 12:05:40 [warn] 202663#202663: conflicting server name "domain.com" on [::]:80, ignored
2021/01/21 12:05:40 [warn] 202663#202663: conflicting server name "www.domain.com" on [::]:80, ignored
2021/01/21 12:05:40 [warn] 202678#202678: conflicting server name "domain.com" on [::]:80, ignored
2021/01/21 12:05:40 [warn] 202678#202678: conflicting server name "www.domain.com" on [::]:80, ignored
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to [::]:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: bind() to 0.0.0.0:80 failed (98: Address already in use)
2021/01/21 12:05:40 [emerg] 202678#202678: still could not bind()
2021/01/21 12:13:44 [crit] 201626#201626: *92 connect() to unix:/tmp/passenger.NqSGkaJ/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 66.249.69.230, server: domain.com, request: "GET /robots.txt HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.NqSGkaJ/agents.s/core:", host: "domain.com"
#journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 13.
Jan 21 09:42:42 Domain systemd[199844]: Listening on REST API socket for snapd user session agent.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 9.
Jan 21 09:42:42 Domain systemd[199844]: Listening on D-Bus User Message Bus Socket.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 10.
Jan 21 09:42:42 Domain systemd[199844]: Reached target Sockets.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 5.
Jan 21 09:42:42 Domain systemd[199844]: Reached target Basic System.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 2.
Jan 21 09:42:42 Domain systemd[199844]: Reached target Main User Target.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 1.
Jan 21 09:42:42 Domain systemd[199844]: Startup finished in 135ms.
-- Subject: User manager start-up is now complete
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The user manager instance for user 1000 has been started. All services queued
-- for starting have been started. Note that other services might still be starting
-- up or be started at any later time.
-- 
-- Startup of the manager took 135165 microseconds.
Jan 21 09:44:31 Domain sudo[200055]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Jan 21 09:44:32 Domain sudo[200055]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Jan 21 12:02:13 Domain sudo[202588]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Jan 21 12:02:15 Domain sudo[202588]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory

I’m really confused since it was working at first and it stopped suddenly.

Thanks in advance

  • Hi there @rubioli,

    As far as I can see the main problem is that there is another service listening on port 80 already. To check that run the following command:

    • sudo netstat -plant | grep 80

    Basically, you can’t have 2 services listening on the same port. So if you have Apache listening on port 80, you need to decide if you want to keep using Apache or Nginx and stop the one that is not needed.

    Let me know how it goes.
    Regards,
    Bobby

@bobbyiliev appreciate your help

I don’t run apache, only Nginx and the output is

#sudo netstat -plant | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      201626/nginx: worke 
tcp        0      0 206.189.7.79:58618      104.21.71.15:80         TIME_WAIT   -                   
tcp6       0      0 :::80                   :::*                    LISTEN      201626/nginx: worke 

Any suggestions? Thanks in advance

  • Hi there @rubioli,

    Ok, so from the netstat output, the Nginx service seems to be running. After having a closer look in the error log output, I can see that the Passenger service is not running, this is why you are seeing the 502 error.

    I believe that once you start the passenger service, the 502 error will be gone.

    Let me know how it goes.
    Regards,
    Bobby

Thanks a lot @bobbyiliev

When I do passenger startI get:

Could not start the Nginx engine:
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] still could not bind()

Also when I deploy using capistrano I have There are no Phusion Passenger-served applications running whose paths begin with '/home/deploy/domain'. so I did cd to that folder and did: passenger start --port 80 and got:

*** ERROR: the Nginx configuration that Phusion Passenger Standalone generated internally contains problems. The error message returned by the Nginx engine is:

    nginx: the configuration file nginx.conf syntax is ok
    nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
    nginx: configuration file nginx.conf test failed

This probably means that you have found a bug in Phusion Passenger Standalone. Please report this bug to our Github issue tracker: https://github.com/phusion/passenger/issues

In the bug report, please include this error message, as well as the contents of the file /tmp/passenger-standalone-2bstm0.log 

the command passenger start in the same folder give:

Could not start the Nginx engine:
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:3000 failed (98: Address already in use)
nginx: [emerg] still could not bind()

So for port 3000 I did sudo fuser -k 3000/tcp and now when I do sudo netstat -plant | grep 3000 there is nothing that is running.

I appreciate your help @bobbyiliev

Submit an Answer