mirror of
https://github.com/unraid/webgui.git
synced 2026-01-09 02:59:52 -06:00
rc.nginx: force a restart of nginx when interface binding fails
This prevents 'access refused', which may happen when nginx gets initially started with no IP assignment.
This commit is contained in:
@@ -31,6 +31,7 @@ TSCERTPATH="$SSL/certs/ts_bundle.pem"
|
||||
MYSERVERS="/boot/config/plugins/dynamix.my.servers/myservers.cfg"
|
||||
DEFAULTS="/etc/default/nginx"
|
||||
SYSTEM="/sys/class/net"
|
||||
SYSLOG="/var/log/syslog"
|
||||
|
||||
# Load defaults
|
||||
# Defines NGINX_CUSTOMFA for custom Content-Security-Policy frame-ancestors url
|
||||
@@ -774,7 +775,13 @@ nginx_reload(){
|
||||
if nginx_check; then
|
||||
log "Reloading $DAEMON configuration..."
|
||||
kill -HUP $(cat $PID)
|
||||
sleep 3
|
||||
sleep 1
|
||||
if tail -8 $SYSLOG | grep -qm1 'Address already in use'; then
|
||||
# unconditional restart when binding fails
|
||||
sleep 2
|
||||
log "Restarting $DAEMON..."
|
||||
nginx_renew
|
||||
fi
|
||||
else
|
||||
log "Invalid configuration, $DAEMON not reloaded"
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user