Posted by ckinikar, 07-31-2013, 03:48 PM | Hi,
I have purged all existing nginx nginx-full and nginx-common and compiled nginx-1.5.0.
I can start it with below command
root@ns1:~# /usr/local/nginx/sbin/nginx
root@ns1:~# find / -name nginx.pid
/usr/local/nginx/logs/nginx.pid
After starting I can reload, no problem.
root@ns1:~# /usr/local/nginx/sbin/nginx -s reload
When I stop, it can't reload
root@ns1:~# /usr/local/nginx/sbin/nginx -s stop
root@ns1:~# /usr/local/nginx/sbin/nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
root@ns1:~# /usr/local/nginx/sbin/nginx
When I reboot the server, how can I start nginx automatically?
I have tried to add /usr/local/nginx/sbin/nginx in /etc/rc.local, but it didn't worked.
root@ns1:~# find / -name nginx
/root/nginx-1.5.0/objs/nginx
/usr/local/nginx
/usr/local/nginx/sbin/nginx
root@ns1:~# find / -name nginx.conf
/root/nginx-1.5.0/conf/nginx.conf
/usr/share/doc/fcg****p/examples/nginx.conf
/usr/local/nginx/conf/nginx.conf
root@ns1:~#
Please see below output while compile.
Thanks.
|
Posted by Scott.Mc, 07-31-2013, 04:37 PM | Check /usr/local/nginx/logs/error.log to see why it won't start, maybe something is already listening on the port ?
|
Posted by zacharooni, 07-31-2013, 05:27 PM | When you start up NGINX, it creates the .pid file the process ID of the running NGINX master process. You can't reload nginx when it's stopped because there's no PID to send a reload (HUP or USR1 signal I believe) to. You have to reload while NGINX is running. In regards to having it start when Debian boots, you'll have to add an entry in /etc/rc.local, or take a look on how to create an init script, like the guide posted here: http://www.rackspace.com/knowledge_c...nx-init-script
|
Posted by ckinikar, 08-01-2013, 01:35 AM | Hi,
I have tried to put sudo /usr/local/nginx/sbin/nginx in /etc/rc.local, but after reboot it isn't working.
There are no processes working on port 80 after reboot. Also, nothing found in error log after reboot.
root@ns1:~# find / -name nginx.pid
root@ns1:~# vi /usr/local/nginx/logs/error.log
root@ns1:~# lsof -i :80
root@ns1:~# lsof -i :80
root@ns1:~# sudo /usr/local/nginx/sbin/nginx
Please help.
Thanks.
|
Posted by zacharooni, 08-01-2013, 01:47 AM | No need for sudo.
|
Posted by ckinikar, 08-01-2013, 02:03 AM | Hi,
Removed sudo but after reboot nginx isn't working.
Please suggest any changes or alternative.
Thanks.
|
Posted by zacharooni, 08-01-2013, 02:17 AM | What is the result of:
tail -20 /usr/local/nginx/logs/error.log
|
Posted by ckinikar, 08-01-2013, 02:48 AM | Hi,
Please see below output after reboot, for tail -20 /usr/local/nginx/logs/error.log
client is not allowing me to show IP and URL in forum, please excuse for that.
Thanks.
|
Posted by ckinikar, 08-01-2013, 04:48 AM | Hi,
I have created strtup script as shown:
http://www.debian-administration.org/articles/28
#! /bin/sh
# /etc/init.d/blah
#
# Some things that run always
/usr/local/nginx/sbin/nginx
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script blah "
echo "Could do more here"
;;
stop)
echo "Stopping script blah"
echo "Could do more here"
;;
*)
echo "Usage: /etc/init.d/blah {start|stop}"
exit 1
;;
esac
exit 0
My problem is resolved.
Thank you everyone.
|
|
Add to Favourites
Print this Article |