Eu atualizei o CentOS 7 e agora o nginx não inicia automaticamente na inicialização do sistema

1

Eu atualizei o sistema operacional do meu servidor (CentOS 7) através do comando "yum update" e agora o NGINX não inicia durante a inicialização do sistema.

No log de inicialização mostra:

Sep 15 05:41:30 mgniers nm-dispatcher: req:1 'hostname': start running ordered scripts...
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7261] dhcp-init: Using DHCP client 'dhclient'
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7261] manager: rfkill: WiFi enabled by radio killswitch; enabled by state file
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7261] manager: rfkill: WWAN enabled by radio killswitch; enabled by state file
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7262] manager: Networking is enabled by state file
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7264] Loaded device plugin: NMBondDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7264] Loaded device plugin: NMBridgeDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7265] Loaded device plugin: NMDummyDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7265] Loaded device plugin: NMEthernetDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7265] Loaded device plugin: NMInfinibandDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7265] Loaded device plugin: NMIPTunnelDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7265] Loaded device plugin: NMMacsecDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7295] Loaded device plugin: NMMacvlanDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7295] Loaded device plugin: NMTunDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7295] Loaded device plugin: NMVethDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7295] Loaded device plugin: NMVlanDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7295] Loaded device plugin: NMVxlanDeviceFactory (internal)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7351] Loaded device plugin: NMWifiFactory (/usr/lib64/NetworkManager/libnm-device-plugin-wifi.so)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7377] Loaded device plugin: NMTeamFactory (/usr/lib64/NetworkManager/libnm-device-plugin-team.so)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7389] device (lo): link connected
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7396] manager: (lo): new Generic device (/org/freedesktop/NetworkManager/Devices/1)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7413] manager: (dummy0): new Dummy device (/org/freedesktop/NetworkManager/Devices/2)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7428] manager: (eth0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/3)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7448] device (eth0): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Sep 15 05:41:30 mgniers kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7474] device (eth0): link connected
Sep 15 05:41:30 mgniers kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7500] manager: (teql0): new Generic device (/org/freedesktop/NetworkManager/Devices/4)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7550] manager: (tunl0): new IPTunnel device (/org/freedesktop/NetworkManager/Devices/5)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7565] manager: (gre0): new IPTunnel device (/org/freedesktop/NetworkManager/Devices/6)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7603] manager: (gretap0): new Generic device (/org/freedesktop/NetworkManager/Devices/7)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7613] manager: (ip_vti0): new Generic device (/org/freedesktop/NetworkManager/Devices/8)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7623] manager: (ip6_vti0): new Generic device (/org/freedesktop/NetworkManager/Devices/9)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7638] manager: (sit0): new IPTunnel device (/org/freedesktop/NetworkManager/Devices/10)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7648] manager: (ip6tnl0): new Generic device (/org/freedesktop/NetworkManager/Devices/11)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7668] manager: (ip6gre0): new Generic device (/org/freedesktop/NetworkManager/Devices/12)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7864] device (eth0): state change: unavailable -> disconnected (reason 'none') [20 30 0]
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7883] policy: auto-activating connection 'System eth0'
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7914] device (eth0): Activation: starting connection 'System eth0' (5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03)
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7920] device (eth0): state change: disconnected -> prepare (reason 'none') [30 40 0]
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7924] manager: NetworkManager state is now CONNECTING
Sep 15 05:41:30 mgniers NetworkManager[3277]: <info>  [1505464890.7942] device (eth0): state change: prepare -> config (reason 'none') [40 50 0]
Sep 15 05:41:30 mgniers firewalld[3266]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
Sep 15 05:41:30 mgniers firewalld[3266]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Sep 15 05:41:30 mgniers firewalld[3266]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
Sep 15 05:41:30 mgniers firewalld[3266]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Sep 15 05:41:30 mgniers firewalld[3266]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
Sep 15 05:41:30 mgniers firewalld[3266]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Sep 15 05:41:30 mgniers kernel: random: crng init done
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0265] device (eth0): state change: config -> ip-config (reason 'none') [50 70 0]
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0313] device (eth0): state change: ip-config -> ip-check (reason 'none') [70 80 0]
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0323] device (eth0): state change: ip-check -> secondaries (reason 'none') [80 90 0]
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0325] device (eth0): state change: secondaries -> activated (reason 'none') [90 100 0]
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0326] manager: NetworkManager state is now CONNECTED_LOCAL
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0480] manager: NetworkManager state is now CONNECTED_SITE
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0481] policy: set 'System eth0' (eth0) as default for IPv4 routing and DNS
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0493] device (eth0): Activation: successful, device activated.
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0498] manager: startup complete
Sep 15 05:41:31 mgniers NetworkManager[3277]: <info>  [1505464891.0502] manager: NetworkManager state is now CONNECTED_GLOBAL
Sep 15 05:41:31 mgniers nm-dispatcher: req:2 'up' [eth0]: new request (3 scripts)
Sep 15 05:41:31 mgniers nm-dispatcher: req:2 'up' [eth0]: start running ordered scripts...
Sep 15 05:41:31 mgniers nm-dispatcher: req:3 'connectivity-change': new request (3 scripts)
    Sep 15 04:33:05 mgniers systemd: Started Network Manager Wait Online.
    Sep 15 04:33:05 mgniers systemd: Starting LSB: Bring up/down networking...
    Sep 15 04:33:05 mgniers nm-dispatcher: req:3 'connectivity-change': start running ordered scripts...
    Sep 15 04:33:05 mgniers network: Bringing up loopback interface:  [  OK  ]
    Sep 15 04:33:05 mgniers network: Bringing up interface eth0:  [  OK  ]
    Sep 15 04:33:05 mgniers systemd: Started LSB: Bring up/down networking.
    Sep 15 04:33:05 mgniers systemd: Reached target Network.
    Sep 15 04:33:05 mgniers systemd: Starting Network.
    Sep 15 04:33:05 mgniers systemd: Reached target Network is Online.
    Sep 15 04:33:05 mgniers systemd: Starting Network is Online.
    Sep 15 04:33:05 mgniers systemd: Starting nginx - high performance web server...
    Sep 15 04:33:05 mgniers systemd: Starting LSB: Start and stop FastCGI processes...
    Sep 15 04:33:05 mgniers systemd: Starting MySQL Community Server...
    Sep 15 04:33:05 mgniers systemd: Starting The PHP FastCGI Process Manager...
    Sep 15 04:33:05 mgniers systemd: Starting Fail2Ban Service...
    Sep 15 04:33:05 mgniers systemd: Starting Dynamic System Tuning Daemon...
    Sep 15 04:33:05 mgniers systemd: Starting Pure-FTPd FTP server...
    Sep 15 04:33:05 mgniers systemd: Starting /etc/rc.d/rc.local Compatibility...
    Sep 15 04:33:05 mgniers systemd: Starting OpenSSH server daemon...
    Sep 15 04:33:05 mgniers nginx: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    Sep 15 04:33:05 mgniers nginx: nginx: [emerg] bind() to [**My IPv6 address here**]:80 failed (99: Cannot assign requested address)
    Sep 15 04:33:05 mgniers nginx: nginx: configuration file /etc/nginx/nginx.conf test failed
    Sep 15 04:33:05 mgniers systemd: nginx.service: control process exited, code=exited status=1
    Sep 15 04:33:05 mgniers systemd: Failed to start nginx - high performance web server.
    Sep 15 04:33:05 mgniers systemd: Unit nginx.service entered failed state.
    Sep 15 04:33:05 mgniers systemd: nginx.service failed.
    Sep 15 04:33:05 mgniers systemd: Started /etc/rc.d/rc.local Compatibility.
Sep 15 05:41:31 mgniers spawn-fcgi: Starting spawn-fcgi: [  OK  ]
Sep 15 05:41:31 mgniers systemd: Started LSB: Start and stop FastCGI processes.
Sep 15 05:41:31 mgniers systemd: Started Dynamic System Tuning Daemon.
Sep 15 05:41:31 mgniers fail2ban-client: 2017-09-15 05:41:31,760 fail2ban.server         [3616]: INFO    Starting Fail2ban v0.9.6
Sep 15 05:41:31 mgniers fail2ban-client: 2017-09-15 05:41:31,761 fail2ban.server         [3616]: INFO    Starting in daemon mode
Sep 15 05:41:31 mgniers mysqld_safe: 170915 05:41:31 mysqld_safe Logging to '/var/log/mysqld.log'.
Sep 15 05:41:31 mgniers mysqld_safe: 170915 05:41:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Sep 15 05:41:31 mgniers systemd: Started Fail2Ban Service.
Sep 15 05:41:32 mgniers systemd: Started MySQL Community Server.
Sep 15 05:41:32 mgniers systemd: Started ISPConfig DC Sync.
Sep 15 05:41:32 mgniers systemd: Starting ISPConfig DC Sync...
Sep 15 05:41:32 mgniers NetworkManager[3277]: <info>  [1505464892.7411] policy: set 'System eth0' (eth0) as default for IPv6 routing and DNS
Sep 15 05:41:33 mgniers systemd: Started The PHP FastCGI Process Manager.
Sep 15 05:41:33 mgniers systemd: Reached target Multi-User System.
Sep 15 05:41:33 mgniers systemd: Starting Multi-User System.
Sep 15 05:41:33 mgniers systemd: Starting Update UTMP about System Runlevel Changes...
Sep 15 05:41:33 mgniers systemd: Started Update UTMP about System Runlevel Changes.
Sep 15 05:41:33 mgniers systemd: Startup finished in 1.741s (kernel) + 3.868s (userspace) = 5.609s.

Curiosamente, posso iniciar o NGINX manualmente após a inicialização e funciona bem.

CentOS 7.4.1708

NGINX 1.12.1

/etc/systemd/system/multi-user.target.wants/nginx.service

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target
    
por dioo 15.09.2017 / 10:01

2 respostas

2

Eu acho que a razão está aqui: bind () para [ Meu endereço IPv6 aqui ]: 80 falhou (99: Não é possível atribuir o endereço solicitado)

quando você inicia o nginx manualmente, todos os outros daemons são iniciados. O Nginx não inicia enquanto booiting devido a este problema. Todos os outros erros aparecem no log após este event.check nginx.com - talvez haja algo com endereços (Não é possível atribuir o erro de endereço solicitado). Nginx com configuração limpa funciona bem (quero dizer autostart) após a atualização do CentOS (v 7.4). / p>     

por 15.09.2017 / 10:21
0

Encontrei a resposta no Fórum do Linode.

Crie o arquivo: /etc/sysctl.d/80-network.conf com o conteúdo:

net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1

... para permitir que os daemons se vinculem a interfaces de rede não existentes.

Fonte: link

    
por 16.09.2017 / 20:51

Tags