You are not logged in.

#1 2017-01-30 09:24:21

yousuc
Member
From: Missouri
Registered: 2016-07-27
Posts: 19
Website

[PROPOSED FIX] nginx.service when server has more than 1 ip address

I have multiple IPs on my Arch servers that nginx uses. Every time we have to do a reboot, nginx.service keeps failing because systemd starts nginx before the network is fully up with all addresses.

The default nginx.service has the following:

[Unit]
Description=A high performance web server and a reverse proxy server
After=network.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
PrivateDevices=yes
SyslogLevel=err

ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;'
ExecReload=/usr/bin/kill -HUP $MAINPID
KillSignal=SIGQUIT
KillMode=mixed

[Install]
WantedBy=multi-user.target

Here is my proposed fix for the situation. This works perfectly fine if you have only 1 ip defined or multiple IP addresses defined for your server and nginx.

[Unit]
Description=A high performance web server and a reverse proxy server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
PrivateDevices=yes
SyslogLevel=err

ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;'
ExecReload=/usr/bin/kill -HUP $MAINPID
KillSignal=SIGQUIT
KillMode=mixed

[Install]
WantedBy=multi-user.target

Thought I would share this in hopes this will be updated in the nginx package.

Offline

#2 2017-01-30 11:41:24

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [PROPOSED FIX] nginx.service when server has more than 1 ip address

This isn't the right place to post, the Arch devs don't really visit the forums.

Opening a bug against the nginx package would be the best way to get their attention, although if the current service file is the one shipped by upstream then it probably won't be changed.

You can create a drop-in file on your system to overide the standard behaviour, this way you won't have to worry about restarting nginx.
https://wiki.archlinux.org/index.php/Sy … ided_units

Last edited by Slithery (2017-01-30 11:44:33)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB