| Summary: | nginx fails to start on boot when set to bind to an address | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Bruno Larini <br.larini> |
| Component: | systemd | Assignee: | systemd-maint |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 24 | CC: | bperkins, johannbg, lnykryn, msekleta, muadda, ssahani, s, systemd-maint, zbyszek |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-23 15:53:35 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Yes, binding to a specific IP address requires that address to be available. For a system socket unit, you should set FreeBind=yes (https://www.freedesktop.org/software/systemd/man/systemd.socket.html#FreeBind=) . I don't know how to set this in the nginx config. You shouldn't modify packaged unit files in /usr/lib/systemd. Create a drop-in in /etc/. See https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Description. |
Description of problem: nginx/1.10.2 fails to start on boot when configured to bind to a specific network interface, configured with NetworkManager. Version-Release number of selected component (if applicable): nginx-1.10.2-1.fc24.x86_64 systemd-229-16.fc24.x86_64 NetworkManager-1.2.4-3.fc24.x86_64 Steps to Reproduce: 1. Install nginx from the official repository 2. Change the config file to bind to a specific interface (listen xxx.xxx.xxx.xxx;) 3. Set to nginx to start on boot (systemctl enable nginx.service) 4. Reboot the computer Actual results: nginx service not running. Expected results: nginx service running after reboot. Additional info: Even the previous version had this problem, but I manually changed the Unit section in systemd from this: After=network.target remote-fs.target nss-lookup.target to this: After=network-online.target and it solved the issue. After the last update the systemd config file was replaced, so I had to change it again. The following is the message from the error to bind to the interface: 22:00 nginx.service: Failed with result 'exit-code'. systemd 22:00 nginx.service: Unit entered failed state. systemd 22:00 Failed to start The nginx HTTP and reverse proxy server. systemd 22:00 nginx.service: Control process exited, code=exited status=1 systemd 22:00 nginx: configuration file /etc/nginx/nginx.conf test failed nginx 22:00 nginx: [emerg] bind() to xxx.xxx.xxx.xxx:80 failed (99: Cannot assign requested address) nginx