Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Can't restart/reload nginx in my ubuntu droplet

I have a DigitalOcean droplet, after launching a laravel app into production I tried the following command:

sudo systemctl reload nginx

But I get this error:

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

I ran sudo nginx -t to see if there were errors but conf and syntax is ok, after that I ran:

sudo nano /var/log/nginx/error.log

and I got this:

2020/01/16 14:53:53 [notice] 14195#14195: signal process started
2020/01/16 14:53:53 [error] 14195#14195: invalid PID number "" in "/run/nginx.pid"
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: still could not bind()

Any idea why I can't restart my web server, my webs are still visible but I can't seem to restart or reload nginx.

0 likes
3 replies
parjuag's avatar

You can use all of this useful commands to manage nginx properly.

sudo systemctl start nginx sudo systemctl stop nginx sudo systemctl restart nginx

One can use the following service command to restart or start or stop Nginx web server on an older version of Ubuntu server:

sudo service nginx start sudo service nginx stop sudo service nginx restart

OR

sudo /etc/init.d/nginx start sudo /etc/init.d/nginx stop sudo /etc/init.d/nginx restart

Gabotronix's avatar

None of this worked, see OP again for more details.

meduz's avatar

Hi! I encountered the same issue, and finally found the solution.

While doing sudo lsof -i:80, it showed apache2 processes were running, while it’s not supposed to run at all because we’re on a nginx setup.

So I could stop Apach with sudo service apache2 stop, and then starting nginx (sudo service nginx start) worked like a charm.

1 like

Please or to participate in this conversation.