Can't start nginx

Hello,

I’ve tried a serveral times to start nginx but it always ends with no
happy end.

Download and compiling is no problem for me.

So here goes my way that i do it:

  1. cd /tmp
    wget wget http://sysoev.ru/nginx/nginx-0.7.61.tar.gz
    tar xvfz nginx-0.7.61.tar.gz
    cd nginx-0.7.61

./configure
–prefix=/usr
–conf-path=/etc/nginx/nginx.conf
–http-log-path=/var/log/nginx/access_log
–error-log-path=/var/log/nginx/error_log
–pid-path=/var/run/nginx.pid
–http-client-body-temp-path=/var/tmp/nginx/client
–http-proxy-temp-path=/var/tmp/nginx/proxy
–http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
–with-md5-asm --with-md5=/usr/include
–with-http_realip_module
–with-http_ssl_module
–with-http_stub_status_module

make
make install

  1. vi /etc/init.d/nginx

#! /bin/sh

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

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

Include nginx defaults if available

if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi

set -e

case “$1” in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile
/usr/local/nginx/logs/nginx.pid --exec $DAEMON – $DAEMON_OPTS
echo “$NAME.”
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile
/usr/local/nginx/logs/nginx.pid --exec $DAEMON
echo “$NAME.”
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile
/usr/local/nginx/logs/nginx.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile
/usr/local/nginx/logs/nginx.pid --exec $DAEMON – $DAEMON_OPTS
echo “$NAME.”
;;
reload)
echo -n "Reloading $DESC configuration: "
start-stop-daemon --stop --signal HUP --quiet --pidfile
/usr/local/nginx/logs/nginx.pid --exec $DAEMON
echo “$NAME.”
;;
*)
N=/etc/init.d/$NAME
echo “Usage: $N {start|stop|restart|force-reload}” >&2
exit 1
;;
esac

exit 0

  1. chmod 755 /etc/init.d/nginx

  2. /etc/init.d/nginx start

But it won’t start because of this error here:

(root)-(/tmp/nginx-0.7.61) $ /etc/init.d/nginx start
/etc/init.d/nginx: line 1: N: command not found

Try this:

sh -x /etc/init.d/nginx start

and see what happen or put it in a reply, as you wish.

Robert G. wrote:

Try this:

sh -x /etc/init.d/nginx start

and see what happen or put it in a reply, as you wish.

Hello, doesn’t work either.

Robert G. wrote:

Andreas Vieten wrote:

Robert G. wrote:

Try this:

sh -x /etc/init.d/nginx start

and see what happen or put it in a reply, as you wish.

Hello, doesn’t work either.

I didnt say its gonna work, but you can see where the error is coming
from…

Wait, are u using Ubuntu?! If so, then do this first:

rm -f /bin/sh; ln -s /bin/bash /bin/sh (as root user)

Andreas Vieten wrote:

Robert G. wrote:

Try this:

sh -x /etc/init.d/nginx start

and see what happen or put it in a reply, as you wish.

Hello, doesn’t work either.

I didnt say its gonna work, but you can see where the error is coming
from…

Hello
exuce me for posting again in this old question
i have problem for starting nginx
i tried
[[email protected] libmemcached-0.48]# sh -x /etc/init.d/nginx stop

  • . /etc/rc.d/init.d/functions
    ++ TEXTDOMAIN=initscripts
    ++ umask 022
    ++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
    ++ export PATH
    ++ ‘[’ -z ‘’ ‘]’
    ++ COLUMNS=80
    ++ ‘[’ -z ‘’ ‘]’
    +++ /sbin/consoletype
    ++ CONSOLETYPE=pty
    ++ ‘[’ -f /etc/sysconfig/i18n -a -z ‘’ -a -z ‘’ ‘]’
    ++ . /etc/profile.d/lang.sh
    ++ unset LANGSH_SOURCED
    ++ ‘[’ -z ‘’ ‘]’
    ++ ‘[’ -f /etc/sysconfig/init ‘]’
    ++ . /etc/sysconfig/init
    +++ BOOTUP=color
    +++ RES_COL=60
    +++ MOVE_TO_COL=‘echo -en \033[60G’
    +++ SETCOLOR_SUCCESS=‘echo -en \033[0;32m’
    +++ SETCOLOR_FAILURE=‘echo -en \033[0;31m’
    +++ SETCOLOR_WARNING=‘echo -en \033[0;33m’
    +++ SETCOLOR_NORMAL=‘echo -en \033[0;39m’
    +++ PROMPT=yes
    +++ AUTOSWAP=no
    +++ ACTIVE_CONSOLES=’/dev/tty[1-6]’
    +++ SINGLE=/sbin/sushell
    ++ ‘[’ pty = serial ‘]’
    ++
    __sed_discard_ignored_files=’/(~|.bak|.orig|.rpmnew|.rpmorig|.rpmsave)$/d’

  • . /etc/sysconfig/network
    ++ NETWORKING=yes
    ++ HOSTNAME=server.ghoghnooschat.ir
    ++ GATEWAY=144.76.228.1

  • ‘[’ yes = no ‘]’

  • nginx=/usr/sbin/nginx
    ++ basename /usr/sbin/nginx

  • prog=nginx

  • NGINX_CONF_FILE=/etc/nginx/nginx.conf

  • lockfile=/var/lock/subsys/nginx

  • case “$1” in

  • rh_status_q

  • rh_status

  • stop

  • echo -n 'Stopping nginx: ’
    Stopping nginx: + killproc nginx -QUIT

  • local RC killlevel= base pid pid_file= delay try

  • RC=0

  • delay=3

  • try=0

  • ‘[’ 2 -eq 0 ‘]’

  • ‘[’ nginx = -p ‘]’

  • ‘[’ nginx = -d ‘]’

  • ‘[’ -n -QUIT ‘]’

  • killlevel=-QUIT

  • base=nginx

  • __pids_var_run nginx ‘’

  • local base=nginx

  • local pid_file=/var/run/nginx.pid

  • pid=

  • ‘[’ -f /var/run/nginx.pid ‘]’

  • local line p

  • ‘[’ ‘!’ -r /var/run/nginx.pid ‘]’

  • :

  • read line

  • ‘[’ -z 25826 ‘]’

  • for p in ‘$line’

  • ‘[’ -z ‘’ -a -d /proc/25826 ‘]’

  • pid=’ 25826’

  • :

  • read line

  • ‘[’ -z ‘’ ‘]’

  • break

  • ‘[’ -n ’ 25826’ ‘]’

  • return 0

  • RC=0

  • ‘[’ -z ’ 25826’ ‘]’

  • ‘[’ -n ’ 25826’ ‘]’

  • ‘[’ color = verbose -a -z ‘’ ‘]’

  • ‘[’ -z -QUIT ‘]’

  • checkpid 25826

  • local i

  • for i in ‘$*’

  • ‘[’ -d /proc/25826 ‘]’

  • return 0

  • kill -QUIT 25826

  • RC=0

  • ‘[’ 0 -eq 0 ‘]’

  • success ‘nginx -QUIT’

  • ‘[’ color ‘!=’ verbose -a -z ‘’ ‘]’

  • echo_success

  • ‘[’ color = color ‘]’

  • echo -en ‘\033[60G’
    + echo -n ‘[’
    [+ ‘[’ color = color ‘]’

  • echo -en ‘\033[0;32m’

  • echo -n ’ OK ’
    OK + ‘[’ color = color ‘]’

  • echo -en ‘\033[0;39m’

  • echo -n ‘]’
    ]+ echo -ne ‘\r’

  • return 0

  • return 0

  • ‘[’ -z -QUIT ‘]’

  • return 0

  • retval=0

  • echo

  • ‘[’ 0 -eq 0 ‘]’

  • rm -f /var/lock/subsys/nginx

  • return 0

and then :
[[email protected] libmemcached-0.48]# sh -x /etc/init.d/nginx start

  • . /etc/rc.d/init.d/functions
    ++ TEXTDOMAIN=initscripts
    ++ umask 022
    ++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
    ++ export PATH
    ++ ‘[’ -z ‘’ ‘]’
    ++ COLUMNS=80
    ++ ‘[’ -z ‘’ ‘]’
    +++ /sbin/consoletype
    ++ CONSOLETYPE=pty
    ++ ‘[’ -f /etc/sysconfig/i18n -a -z ‘’ -a -z ‘’ ‘]’
    ++ . /etc/profile.d/lang.sh
    ++ unset LANGSH_SOURCED
    ++ ‘[’ -z ‘’ ‘]’
    ++ ‘[’ -f /etc/sysconfig/init ‘]’
    ++ . /etc/sysconfig/init
    +++ BOOTUP=color
    +++ RES_COL=60
    +++ MOVE_TO_COL=‘echo -en \033[60G’
    +++ SETCOLOR_SUCCESS=‘echo -en \033[0;32m’
    +++ SETCOLOR_FAILURE=‘echo -en \033[0;31m’
    +++ SETCOLOR_WARNING=‘echo -en \033[0;33m’
    +++ SETCOLOR_NORMAL=‘echo -en \033[0;39m’
    +++ PROMPT=yes
    +++ AUTOSWAP=no
    +++ ACTIVE_CONSOLES=’/dev/tty[1-6]’
    +++ SINGLE=/sbin/sushell
    ++ ‘[’ pty = serial ‘]’
    ++
    __sed_discard_ignored_files=’/(~|.bak|.orig|.rpmnew|.rpmorig|.rpmsave)$/d’
  • . /etc/sysconfig/network
    ++ NETWORKING=yes
    ++ HOSTNAME=server.ghoghnooschat.ir
    ++ GATEWAY=144.76.228.1
  • ‘[’ yes = no ‘]’
  • nginx=/usr/sbin/nginx
    ++ basename /usr/sbin/nginx
  • prog=nginx
  • NGINX_CONF_FILE=/etc/nginx/nginx.conf
  • lockfile=/var/lock/subsys/nginx
  • case “$1” in
  • rh_status_q
  • rh_status
  • exit 0

and my nginx don’t start!
what should i do ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs