FS#46500 - [nginx] Systemd file with default PID/error
Attached to Project:
Arch Linux
Opened by Łukasz Pożarlik (pozar87) - Wednesday, 30 September 2015, 16:43 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Thursday, 05 May 2016, 13:08 GMT
Opened by Łukasz Pożarlik (pozar87) - Wednesday, 30 September 2015, 16:43 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Thursday, 05 May 2016, 13:08 GMT
|
Details
Description:
The generated systemd file (/usr/lib/systemd/system/nginx.service) contain default PID. This is most likely by compilation with option (I didn't confirm that): --pid-path=/run/nginx.pid \ This result with error if one try to override PID file via NGINX configuration. Same problem is related with: --error-log-path=stderr \ I suggest remove this option from compilation and add them as a default entries to /etc/nginx/nginx.conf Additional info: * nginx 1.8.0-1 Step to reproduce: * install nginx * add PID setup i.e. pid /var/run/nginx.pid; to file /etc/nginx/nginx.conf * try to start nginx via systemd # systemctl status nginx * nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2015-09-30 16:16:47 UTC; 5s ago Process: 1080 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=1/FAILURE) Main PID: 988 (code=exited, status=0/SUCCESS) Sep 30 16:16:47 pi systemd[1]: Starting A high performance web server and a reverse proxy server... Sep 30 16:16:47 pi nginx[1080]: 2015/09/30 16:16:47 [emerg] 1080#0: "pid" directive is duplicate in /etc/nginx/nginx.conf:8 Sep 30 16:16:47 pi systemd[1]: nginx.service: Control process exited, code=exited status=1 Sep 30 16:16:47 pi systemd[1]: Failed to start A high performance web server and a reverse proxy server. Sep 30 16:16:47 pi systemd[1]: nginx.service: Unit entered failed state. Sep 30 16:16:47 pi systemd[1]: nginx.service: Failed with result 'exit-code'. Warning: nginx.service changed on disk. Run 'systemctl daemon-reload' to reload units. |
This task depends upon
Closed by Bartłomiej Piotrowski (Barthalion)
Thursday, 05 May 2016, 13:08 GMT
Reason for closing: Won't fix
Thursday, 05 May 2016, 13:08 GMT
Reason for closing: Won't fix
No, it's simply specified in the service as -g 'pid /run/nginx.pid'.
> Same problem is related with:
For the same reason as above. It's in the service.
Neither of the problem you point out come from upstream -- the service is created and shipped by Arch. It's setup the way it is to offer a working setup out of the box.
> This result with error if one try to override PID file via NGINX configuration.
This sounds like a case of "doctor, it hurts when I do this". Is your actual use case changing the PID file to /var/run? What's the point of that when /var/run is a symlink to /run? If you want to change these options, override the ExecStart in the service, not the config file.
Yes, both of mentioned problem are caused by "-g 'pid /run/nginx.pid'..." options provided in ExecStart. I just check the PKGBUILD file and it looks like only relevant lines. You are also right pointing out current setup is working out-of-the-box (which is always good).
All I want to mention is default configuration provided in /usr/lib/systemd/system/nginx.service stays in conflict with default /etc/nginx/nginx.conf (because its impossible to change PID file nor stderr via nginx.service ).
> Is your actual use case changing the PID file to /var/run? What's the point of that when /var/run is a symlink to /run?
No point - just random change in the nginx.conf during the setup.
> If you want to change these options, override the ExecStart in the service, not the config file.
That was also my first idea - however after a while I decided to remove both options from systemd and stick with /etc/nginx/nginx.conf - all config in one place.
Feel free to refuse this ticket. I just wanted to share my experience - as it took me a good hour to solve (I blame my poor experience with nginx here :D).