Page 1 of 2
Process Stopped on boot
Posted: Fri Nov 15, 2013 2:42 pm
by Ocrion
Hello!
For no reason at all whenever I start my server Nginx and Apache2 wont start automatically.

(They are able to start when I manually click on the start button or write service apache2 start in the console it's pretty annoying to do it manually all the time).
Apache2 Error (The one causing it not to start I believe)
[Tue Nov 12 17:57:26 2013] [notice] Graceful restart requested, doing restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Tue Nov 12 17:57:26 2013] [warn] NameVirtualHost 192.168.0.105:8443 has no VirtualHosts
And for Nginx:
2013/11/15 15:34:29 [emerg] 2340#0: bind() to 192.168.0.105:80 failed (99: Cannot assign requested address)
Any tips?
Regards,
Ocrion.
Re: Process Stopped on boot
Posted: Fri Nov 15, 2013 7:22 pm
by skid
While apache error message doesn't looks serious, error from nginx does.
First of all make sure you have init script right in place and number in the apache script is higher than in nginx.
Code: Select all
root@adm:~# ls /etc/rc3.d/|grep -e "apache" -e "nginx"
S20nginx
S91apache2
Re: Process Stopped on boot
Posted: Tue Nov 19, 2013 10:38 am
by Ocrion
skid wrote:While apache error message doesn't looks serious, error from nginx does.
First of all make sure you have init script right in place and number in the apache script is higher than in nginx.
Code: Select all
root@adm:~# ls /etc/rc3.d/|grep -e "apache" -e "nginx"
S20nginx
S91apache2
Hello!
Back from the weekend, this is the output I got.
Code: Select all
root@purushost:~# ls /etc/rc3.d/|grep -e "apache" -e "nginx"
S01nginx
S03apache2
But this time Apache2 were able to start by it self, but not Nginx. It's like random if it starts or not.
Re: Process Stopped on boot
Posted: Tue Nov 19, 2013 5:56 pm
by skid
2013/11/15 15:34:29 [emerg] 2340#0: bind() to 192.168.0.105:80 failed (99: Cannot assign requested address)
This means that someone is using port 80 and nginx can't bind it. It might be a cron task which is trying to fetch data from webser like wget
http://localhost/something
Re: Process Stopped on boot
Posted: Tue Nov 19, 2013 7:03 pm
by Ocrion
But I haven't added any cron jobs other than the defaults that comes with vestaCP?
Re: Process Stopped on boot
Posted: Tue Nov 19, 2013 9:50 pm
by skid
As a quick workaround try this
Code: Select all
echo "service nginx restart" >> /etc/rc.local
Re: Process Stopped on boot
Posted: Wed Nov 20, 2013 11:13 am
by Ocrion
skid wrote:As a quick workaround try this
Code: Select all
echo "service nginx restart" >> /etc/rc.local
That did not work. I tried to make it start with Crontab as well but without success...
Code: Select all
@reboot root /usr/bin/sleep 30 && /etc/init.d/nginx start
@reboot root /usr/bin/sleep 35 && /etc/init.d/apache2 start
Output:
Nov 20 12:10:08 purushost /usr/sbin/cron[3402]: (CRON) INFO (Running @reboot jobs)
Nov 20 12:10:11 purushost /USR/SBIN/CRON[3882]: (root) CMD (/usr/bin/sleep 35 && /etc/init.d/apache2 start)
Nov 20 12:10:11 purushost /USR/SBIN/CRON[3883]: (root) CMD (/usr/bin/sleep 30 && /etc/init.d/nginx start)
The sleep was just a test to see if it had to wait a few seconds before starting them. Arrgh... :(
Re: Process Stopped on boot
Posted: Wed Nov 20, 2013 9:08 pm
by skid
Can you check who is listening on port 80?
Re: Process Stopped on boot
Posted: Wed Nov 20, 2013 10:10 pm
by Ocrion
skid wrote:Can you check who is listening on port 80?
Sure!
Output:
Code: Select all
root@purushost:~# lsof -itcp:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 5517 root 17u IPv4 11645 0t0 TCP purushost.local:http (LISTEN)
nginx 5518 www-data 17u IPv4 11645 0t0 TCP purushost.local:http (LISTEN)
nginx 5519 www-data 17u IPv4 11645 0t0 TCP purushost.local:http (LISTEN)
But that is when I've manually restarted Apache2 and Nginx. When I just rebooted it was an empty output.
Re: Process Stopped on boot
Posted: Wed Nov 20, 2013 10:24 pm
by skid
Do you still see "(99: Cannot assign requested address)" in the error log? If yes then something is definitely listening on a port 80 and right before nginx starts. Or maybe ip is not yet initialized. You can get some info by by adding following into rc.local file
Code: Select all
ifconfig >> /tmp/debug.log
lsof -itcp:80 >> /tmp/debug.log