I'm setting up a nginx proxy server in the network, in the nginx conf file it looks for upstream servers through hostnames; the server uses dhcp 开发者_运维知识库interface.
every time reboot, nginx always fail to start, i ran into init 1 then invoke init 3, i can see that nginx fail because it can't find upstream servers, as network is not ready. when the interface is ready ,i start nginx /etc/init.d/nginx start , all works just fine.
I used debian before, debian starts networking during boot, won't continue booting until network is ready or timeout(dhcp), there won't be such problems.
I wonder how to make ubuntu works the debian way, make the networking ready before other server starts.
I fixed a similar problem by putting a simple script in /etc/network/if-up.d/
.
Try putting this script:
#!/bin/sh
/etc/init.d/nginx restart
give it a name you like and make the script executable. It should be executed each time network is ready.
精彩评论