Nginx failed to start on boot: “Cannot assign requested address”

debian-wheezylinuxmintnginx

When I reboot my server (not nginx, the whole server), Nginx fails to start automatically. After I logged into the server, I can start nginx manually (service nginx start). It works. But if I restart again, I have to manually start Nginx.

In /var/log/boot.log the last lines are:

 * Starting configure virtual network devices^[[74G[ OK ]^M 
Starting nginx: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok^M
nginx: [emerg] bind() to 192.168.1.30:80 failed (99: Cannot assign requested address)^M
nginx: configuration file /etc/nginx/nginx.conf test failed^M
speech-dispatcher disabled; edit /etc/default/speech-dispatcher^M
 * Starting VirtualBox kernel modules       ^[[80G ^M^[[74G[ OK ]^M
 ^[[33m*^[[39;49m VirtualBox Additions disabled, not in a Virtual Machine^M
 * Starting MDM Display Manager mdm       ^[[80G ^M^[[74G[ OK ]^M
saned disabled; edit /etc/default/saned^M

This is a Linux Mint 14 XFCE box with nginx installed from the official repository. It is in fact my dev PC, no virtualization, with a SSD and it boots in less than 10 seconds.

Best Answer

AT the boot time, your network isn't availiable yet, and mysql tries to bind to an ip address that does'nt exist. You should set your mysql startup script to start after network.