Nginx stopped BUT site is still working?

I was browsing through my website when I noticed the SECURE was missing so I decided to SSH in to try testing out a change, after I nano’d the default.conf file I typed in “service nginx reload” and “sudo service nginx start” and all failed. ERROR. ERROR. But my site is still being served up? I thought maybe it’s cache thing but I went to those websites that let you see what your site looks like in different browswers and it shows up still. So my question is how is Nginx not running but my site is still running?

I added the Let’s Encrypt SSL yesterday following this tutorial: https://certbot.eff.org/#ubuntutzesty-nginx

reload won’t kill your server if the new config is invalid. In fact it won’t do anything in that case. You may be confusing it with restart.

Likewise, if you ran start after reload, it would also not do anything, because there would still be the previous instance of nginx running.

You can check on the current state of the process with service nginx status .

I thought /etc/nginx/conf.d/default.conf was the most important file because it had server listen code stuff in it BUT I deleted everything in it.

I then entered “service nginx start” and it worked, sort of.

I enter “service nginx status” and I get this:

root@wow:~# service nginx status
● nginx.service - nginx - high performance web server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-02-08 19:05:11 UTC; 2h 25min ago
     Docs: http://nginx.org/en/docs/
  Process: 27912 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=1/FAILURE)
  Process: 32682 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 32654 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 32661 (nginx)
    Tasks: 2 (limit: 4915)
   Memory: 2.0M
      CPU: 14ms
   CGroup: /system.slice/nginx.service
           ├─32661 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           └─32685 nginx: worker process

Feb 08 19:05:11 wow systemd[1]: Starting nginx - high performance web server...
Feb 08 19:05:11 wow systemd[1]: nginx.service: PID file /var/run/nginx.pid not readable (yet?) after start: No such file or directory
Feb 08 19:05:11 wow systemd[1]: Started nginx - high performance web server.
Feb 08 19:08:26 wow systemd[1]: Reloading nginx - high performance web server.
Feb 08 19:08:26 wow systemd[1]: Reloaded nginx - high performance web server.
root@wow:~#

This FAILURE part shows up in RED. That’s what I mean by sort of. And the site still works.

I got concerned and started snooping around because I noticed HALF of my web-pages were showing the SECURE message on the browser so I was wondered if maybe I left http instead of https somewhere but I have no idea were any of it is coming from since the server listen stuff isn’t coming from /etc/nginx/conf.d/default.conf after all and I know that because I erased all of the code content, restarted nginx and the site still functions.

Is CERT-BOT LETS ENCRYPT NGINX PLUGIN doing this?

Sounds like a mixed content issue, which usually has nothing to do with your web server but with the application (e.g. WordPress).

Try putting these pages into https://www.whynopadlock.com/ .

Does “CertBot” setup it’s own NGINX for https? I completely deleted everything inside /etc/nginx/conf.d/default.conf and THE SITE STILL WORKS. Everything is getting served up.

But there’s a slight error when I run service nginx status

Not sure if I should be worried or just move along adding content to my website.

No, it doesn’t run its own instance of nginx. It may create its own configuration files in addition to your existing ones, though.

You can run nginx -T to see the full configuration that nginx is using.

nginx will NOT do a graceful restart or even start up if there is an error in the configuration. it is possible that you are still serving based on the state of the config flies when nginx started.

you should test the current version of your config files to see if there are errors.

you can run nginx -t or nginx -t -c /path/to/config/file to test the default config or a specific configuration files.

this is different than nginx -T, which is a newer nginx command and will test the config and also print it out.

The default server on Ubuntu is typically configured in /etc/nginx/sites-enabled/default, not /etc/nginx/conf.d/default.conf as with many other systems. Maybe it’s there?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.