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

jlrdw's avatar
Level 75

Nginx all of a sudden shows an error

I setup nginx last night with help from @sinnbeck, Worked all day, even did a reboot after a system update. Turned off computer for supper, booted back up and when I ran:

sudo systemctl restart nginx.service

Got error and it is:

Failed to start A high performance web server and a reverse proxy server

I checked several on line forums, stackoverflow, etc None of the articles I saw solved it. No changes was made to anything in nginx, it just suddenly happened. It's Lubuntu latest LTS version.

I did make sure nothing else was using port 80. Any Ideas?

EDIT

Funny thing is a sudo nginx -t shows

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
0 likes
5 replies
Sinnbeck's avatar

What do you get if you run sudo service nginx status

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Ah it just hit me. It might be a race condition. Apache started first (it gets installed automatically with php). Remove it

sudo apt purge apache2

sudo service nginx restart
jlrdw's avatar
Level 75

I had aready run the following:

:~$ sudo fuser 80/tcp
80/tcp:                851   852   853
:~$ sudo ls -l /proc/851/exe
lrwxrwxrwx 1 root root 0 Mar  2 11:26 /proc/851/exe -> /usr/sbin/nginx
:~$ sudo ls -l /proc/852/exe
lrwxrwxrwx 1 www-data www-data 0 Mar  2 11:26 /proc/852/exe -> /usr/sbin/nginx
:~$ sudo ls -l /proc/853/exe
lrwxrwxrwx 1 www-data www-data 0 Mar  2 11:26 /proc/853/exe -> /usr/sbin/nginx

As you can see only nginx shows up. I even tried:

sudo service apache2 stop

That did not work. Finally I found on a stackoverflow to use:

sudo /etc/init.d/apache2 stop

Then it fixed everything, even after another reboot nginx is running normally.

Thanks to all who answered.

@jasenly you said:

alternatively, you will have to research your application and figure out why it is not responding for too long

So I will give you BA. And @sinnbeck thank you, Your help got me over a big hurdle with Lubuntu.

Sinnbeck's avatar

@jlrdw I suggest uninstalling it as I showed, to avoid it starting again in the future. You have no use for it

Please or to participate in this conversation.