I am running nginx on my server, and by mistake I stared apache2 on the server. After doing that I have a 403 Forbidden error on my home page.

I killed apache2 process, but I still facing the same issue.

Nginx is not running, but I have this on my home page.

403 Forbidden


I checked if nginx is running with the ps aux | grep nginx and here is what i got :

root     27740  0.0  0.0   3408   764 pts/1    R+   20:16   0:00 grep --color=auto nginx

I executed lsof -Pi | grep LISTEN and no processes listening on 80/443 or my web port

Also /etc/init.d/nginx doesn't exist ...

It seems nginx is not installed but i got the 403 error with nginx/1.0.12.

  • 2
    syslog-ng is not nginx! – Michael Hampton Mar 11 '14 at 23:30
  • you are right :), but this is strange i can see on my home page [403 Forbidden] nginx/1.0.12, but i can't find nginx running on my server – Imad Touil Mar 11 '14 at 23:53
  • Why do you think nginx is not running? – Michael Hampton Mar 12 '14 at 0:00
  • How certain are you that nginx is not running? What steps did you take to verify this? Please give us the output of the following: ps aux | grep nginx – QuentinMoss Mar 12 '14 at 0:00
  • Also, update nginx. – QuentinMoss Mar 12 '14 at 0:08

When you say it's not running on your server, what's the output from:

ps aux | grep nginx (any processes running?)

[root@msweb01 ~] $ ps aux | grep "^nginx"
nginx    24214  0.0  0.2 1037044 40580 ?       S    Mar07   0:00 php-fpm: pool default-webnode-check 
nginx    30379  0.0  0.0  60336  4524 ?        S    11:18   0:04 nginx: worker process

lsof -Pi | grep LISTEN (any processes listening on 80/443 or your web port?)

[root@msweb01 ~] $ lsof -Pi | grep LISTEN
nginx      1046     root   13u  IPv4 35851146      0t0  TCP msweb01.dev:81 (LISTEN)
php-fpm   24212     root    7u  IPv4 31168887      0t0  TCP localhost:9001 (LISTEN)
nginx     30377    nginx   13u  IPv4 35851146      0t0  TCP msweb01.dev:81 (LISTEN)

/etc/init.d/nginx status (depending on your systems initd script)

[root@msweb01 ~] $ /etc/init.d/nginx status
nginx (pid  1046) is running...

As Michael Hampton noted, I'd first try:

/etc/init.d/nginx restart to properly bump that nginx server, then depending on your logging options set in nginx.conf and related configs, I'd tail them and work out where your web request is going.

I'm probably completely wrong here, but I had something similar to this recently when testing (and thus swapping) between apache and nginx, in which Apache/PHP had written template config cache to the file system, then starting nginx (which worked fine and worked as expected) later threw an error when hitting the dame template as the nginx user didn't have access to access/update the template cache. Might be something to look at anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.