Ubuntu 使用ezhttp 安装NGINX MYSQL PHP
启动nginx时候爆出:
Restarting nginx daemon: nginx not running/etc/init.d/nginx: 41: [: .: unexpected operator
root@iZ94ytpcjuhZ:/# ps -ef | grep nginx root 21197 21033 0 12:05 pts/0 00:00:00 grep --color=auto nginx root@iZ94ytpcjuhZ:/# ps -ef | grep ngnix root 21199 21033 0 12:05 pts/0 00:00:00 grep --color=auto ngnix root@iZ94ytpcjuhZ:/# nginx The program 'nginx' can be found in the following packages: * nginx-core * nginx-extras * nginx-full * nginx-light * nginx-naxsi Try: apt-get install <selected package> root@iZ94ytpcjuhZ:/# /etc/init.d/nginx -h Usage: /etc/init.d/nginx {start|stop|reload|restart} root@iZ94ytpcjuhZ:/# /etc/init.d/nginx restart Restarting nginx daemon: nginx not running/etc/init.d/nginx: 41: [: .: unexpected operator nginx already running. root@iZ94ytpcjuhZ:/# sudo vi /etc/init.d/nginx root@iZ94ytpcjuhZ:/# sudo cat /etc/init.d/nginx #! /bin/sh # chkconfig: 2345 55 25 # Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and # run 'update-rc.d -f nginx defaults', or use the appropriate command on your # distro. For CentOS/Redhat run: 'chkconfig --add nginx' ### BEGIN INIT INFO # Provides: nginx # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon ### END INIT INFO # Author: ezhttp # website: http://lnmp.org PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="nginx daemon" nginx_location=/usr/local/nginx DAEMON=$nginx_location/sbin/nginx CONFIGFILE=$nginx_location/conf/nginx.conf PIDFILE=$nginx_location/logs/nginx.pid SCRIPTNAME=/etc/init.d/nginx set -e [ -x "$DAEMON" ] || exit 0 acqNginxPid(){ local pid if [ -f $PIDFILE ] ; then pid=`cat $PIDFILE` echo ${pid} fi } do_start() { local pid=`acqNginxPid` if [ ".${pid}" == "." ] ; then $DAEMON -c $CONFIGFILE else echo -n "nginx already running" fi } do_stop() { local pid=`acqNginxPid` if [ ".${pid}" != "." ] ; then kill -INT ${pid} else echo -n "nginx not running" fi } do_reload() { local pid=`acqNginxPid` if [ ".${pid}" != "." ] ; then kill -HUP ${pid} else echo -n "nginx can't reload" fi } case "$1" in start) echo -n "Starting $DESC: $NAME" do_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" do_stop echo "." ;; reload|graceful) echo -n "Reloading $DESC configuration..." do_reload echo "." ;; restart) echo -n "Restarting $DESC: $NAME" do_stop do_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2 exit 3 ;; esac exit 0 root@iZ94ytpcjuhZ:/# root@iZ94ytpcjuhZ:/# root@iZ94ytpcjuhZ:/# PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin root@iZ94ytpcjuhZ:/# DESC="nginx daemon" root@iZ94ytpcjuhZ:/# nginx_location=/usr/local/nginx root@iZ94ytpcjuhZ:/# DAEMON=$nginx_location/sbin/nginx root@iZ94ytpcjuhZ:/# CONFIGFILE=$nginx_location/conf/nginx.conf root@iZ94ytpcjuhZ:/# PIDFILE=$nginx_location/logs/nginx.pid root@iZ94ytpcjuhZ:/# SCRIPTNAME=/etc/init.d/nginx root@iZ94ytpcjuhZ:/# root@iZ94ytpcjuhZ:/# /usr/local/nginx/ client_body_temp/ fastcgi_temp/ logs/ sbin/ uwsgi_temp/ conf/ html/ proxy_temp/ scgi_temp/ root@iZ94ytpcjuhZ:/# ll /usr/local/nginx/ total 44 drwxr-xr-x 11 root root 4096 Apr 15 10:03 ./ drwxr-xr-x 14 root root 4096 Apr 15 09:41 ../ drwx------ 2 www root 4096 Apr 15 10:03 client_body_temp/ drwxr-xr-x 4 root root 4096 Apr 15 09:17 conf/ drwx------ 2 www root 4096 Apr 15 10:03 fastcgi_temp/ drwxr-xr-x 2 root root 4096 Apr 15 09:17 html/ drwxr-xr-x 2 root root 4096 Apr 15 10:03 logs/ drwx------ 2 www root 4096 Apr 15 10:03 proxy_temp/ drwxr-xr-x 2 root root 4096 Apr 15 09:17 sbin/ drwx------ 2 www root 4096 Apr 15 10:03 scgi_temp/ drwx------ 2 www root 4096 Apr 15 10:03 uwsgi_temp/ root@iZ94ytpcjuhZ:/# ll /usr/local/nginx/sbin/ total 7860 drwxr-xr-x 2 root root 4096 Apr 15 09:17 ./ drwxr-xr-x 11 root root 4096 Apr 15 10:03 ../ -rwxr-xr-x 1 root root 8036929 Apr 15 09:17 nginx* root@iZ94ytpcjuhZ:/# /usr/local/nginx/sbin/nginx -h nginx version: nginx/1.6.2 Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives] Options: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configuration and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /usr/local/nginx/) -c filename : set configuration file (default: conf/nginx.conf) -g directives : set global directives out of configuration file root@iZ94ytpcjuhZ:/# /usr/local/nginx/sbin/nginx -v nginx version: nginx/1.6.2 root@iZ94ytpcjuhZ:/# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful root@iZ94ytpcjuhZ:/# /usr/local/nginx/sbin/nginx root@iZ94ytpcjuhZ:/# sudo lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME AliYunDun 1106 root 27u IPv4 10474 0t0 TCP 120.24.159.113:37731->110.75.102.62:http (ESTABLISHED) nginx 21218 root 8u IPv4 120946 0t0 TCP *:http (LISTEN) nginx 21219 www 8u IPv4 120946 0t0 TCP *:http (LISTEN) nginx 21220 www 8u IPv4 120946 0t0 TCP *:http (LISTEN) root@iZ94ytpcjuhZ:/# ^C root@iZ94ytpcjuhZ:/#