OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: cookiemonster on September 08, 2022, 02:48:05 pm

Title: nginx process not stopping
Post by: cookiemonster on September 08, 2022, 02:48:05 pm
Hello.
I'm on OPN ver OPNsense 22.7.4-amd64 with os-nginx (installed)   1.29_1
I had nginx setup and working but later I didn't needed runing so I stopped it until I need it again later. Mostly but not only using the UI.
Looking for something else, I noticed an nginx process seemed to be starting. I went to check and indeed the UI shows nginx disabled "Enable nginx" (unticked) and the top-right icon appears showing running. If I click on the square stop button, it flashes but stays running. Logs:
Code: [Select]
me@OPNsense:~ % sudo tail /var/log/nginx/error.log
2022/09/08 13:29:00 [notice] 18393#120692: signal process started
2022/09/08 13:30:00 [notice] 47431#100680: signal process started
2022/09/08 13:31:00 [notice] 74833#100689: signal process started
2022/09/08 13:32:00 [notice] 6906#100622: signal process started
Signal every minute to start.

Code: [Select]
me@OPNsense:~ % sudo nginx -T
Password:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

Unticking enable, apply; followed by unticking and apply seems to stop it but needs doing again after a reboot.
Any ideas where I need to look for what might be restarting it?
Title: Re: nginx process not stopping
Post by: fabian on September 16, 2022, 10:58:13 pm
The plugin is designed as an infrastructure plugin for other plugins. If you "disable" it in the UI, you will only disable your stuff configured in the plugin itself. This means, another plugin could still be served.
If nothing is configured (mail, TCP/UDP, http) it will just be an empty server.
Title: Re: nginx process not stopping
Post by: cookiemonster on September 18, 2022, 10:09:28 pm
Thanks Fabian. Forgive me but I fail to understand. So if the plugin is installed, it will always be running, even if I disable it in the UI?
Title: Re: nginx process not stopping
Post by: Fright on September 19, 2022, 05:23:30 pm
@cookiemonster
not exactly. plugin will not be "active" (so your servers settings will not be included in nginx.conf) but nginx itself will run. example: you can disable plugin and manage you http servers via opnsense_http_vhost_plugins hook in nginx.conf using a completely handwritten config
Title: Re: nginx process not stopping
Post by: cookiemonster on September 19, 2022, 11:39:32 pm
Thank you both. In that case I need to keep searching what in my setup is causing it to start in that case.
I do have a .conf file in opnsense_stream_vhost_plugins/  so I'll see if renaming it will cause the process to stop completely. Thank you!
Title: Re: nginx process not stopping
Post by: Fright on September 20, 2022, 09:35:29 am
no. right now there is no way to prevent nginx from starting if plugin is installed (at least via gui) imho.
I can make a pr to add the "infrastructure mode" switch, but only if @fabian doesn't mind
Title: Re: nginx process not stopping
Post by: cookiemonster on September 20, 2022, 10:23:52 pm
Thanks Fright but maybe if nobody has asked for this, it might be an edge case. If so, perhaps a note in the README.md file https://github.com/opnsense/plugins/tree/master/www/nginx could mention it and be all that is required for now. I wouldn't want to create unnecessary noise.
If is enough, I could create an "Issue". I'm not proficient enough to do a PR.