免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 33681 | 回复: 8
打印 上一主题 下一主题

nginx无法启动???? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-01 16:15 |只看该作者 |倒序浏览
20可用积分
[root@bogon nginx-0.5.5]# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
2008/09/01 16:42:21 [info] 13161#0: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
2008/09/01 16:42:21 [info] 13161#0: the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully

启动报错如下:
[root@bogon nginx-0.5.5]# /usr/local/nginx/sbin/nginx start
2008/09/01 16:42:31 [emerg] 13162#0: invalid option: "start"
[root@bogon nginx-0.5.5]#

系统的版本是RHEL4的 nginx的版本是0.5.5的

为什么不能用start呢???怎样启动呢?

[ 本帖最后由 ppiqq 于 2008-9-1 16:16 编辑 ]

最佳答案

查看完整内容

启动应该是:nginx -c nginx.conf启动脚本#!/bin/sh# config: /usr/local/nginx/conf/nginx.confnginx_path="/usr/local/nginx"nginx_pid="/var/run/nginx/nginx.pid"# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ ${NETWORKING} = "no" ] && exit 0[ -x $nginx_path/sbin/nginx ] || exit 0RETVAL=0prog="nginx"start() {# ...

论坛徽章:
1
寅虎
日期:2015-01-23 02:35:47
2 [报告]
发表于 2008-09-01 16:15 |只看该作者
启动应该是:nginx -c nginx.conf

启动脚本
#!/bin/sh
# config: /usr/local/nginx/conf/nginx.conf

nginx_path="/usr/local/nginx"
nginx_pid="/var/run/nginx/nginx.pid"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $nginx_path/sbin/nginx ] || exit 0

RETVAL=0
prog="nginx"

start() {
# Start daemons.

if [ -e $nginx_pid -a ! -z $nginx_pid ];then
echo "nginx already running...."
exit 1
fi


if [ -e $nginx_path/conf/nginx.conf ];then
  echo -n $"Starting $prog: "
  $nginx_path/sbin/nginx -c $nginx_path/conf/nginx.conf &
  RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
else
RETVAL=1
fi
return $RETVAL
}

# Stop daemons.
stop() {
        echo -n $"Stopping $prog: "
        killproc -d 10 $nigx_path/sbin/nginx
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f $nginx_pid /var/lock/subsys/$prog
}

# See how we were called.
case "$1" in
start)
        start
        ;;

stop)
        stop
        ;;

reconfigure)
        stop
        start
        ;;

status)
        status $prog
        RETVAL=$?
        ;;

*)
        echo $"Usage: $0 {start|stop|reconfigure|status}"
        exit 1
esac

exit $RETVAL

论坛徽章:
1
寅虎
日期:2015-01-23 02:35:47
3 [报告]
发表于 2008-09-01 16:16 |只看该作者
/usr/local/nginx/sbin/nginx 是SysV格式脚本吗?
去掉start直接执行试试,根本没认到你的start参数

论坛徽章:
0
4 [报告]
发表于 2008-09-01 16:21 |只看该作者
原帖由 cuci 于 2008-9-1 16:16 发表
/usr/local/nginx/sbin/nginx 是SysV格式脚本吗?
去掉start直接执行试试,根本没认到你的start参数



恩 CUCI大哥 是这样的
[root@bogon nginx-0.5.5]# file /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
[root@bogon nginx-0.5.5]#


去掉start启动是这样的
[root@bogon nginx-0.5.5]# /usr/local/nginx/sbin/nginx
[root@bogon nginx-0.5.5]# ps aux | grep nginx
root     13166  0.0  0.2  3764  672 pts/0    S+   16:50   0:00 grep nginx
[root@bogon nginx-0.5.5]#

还是启动不了,版本有问题吗?

论坛徽章:
0
5 [报告]
发表于 2008-09-01 17:09 |只看该作者
还有就是我换成0.6版本的话 编译没有问题,但是make 的时候报错信息如下:
cd /usr/include/pcre/ \
&& make libpcre.la
make[2]: Entering directory `/usr/include/pcre'
make[2]: *** No rule to make target `libpcre.la'.  Stop.
make[2]: Leaving directory `/usr/include/pcre'
make[1]: *** [/usr/include/pcre//.libs/libpcre.a] Error 2
make[1]: Leaving directory `/opt/soft/nginx-0.6.30'
make: *** [install] Error 2

pcre 和 pcre-devel已经安装上去了

论坛徽章:
1
寅虎
日期:2015-01-23 02:35:47
6 [报告]
发表于 2008-09-01 17:21 |只看该作者
这东西俺还没用过,只能给你点思路而已,就像你上面用的,指定配置文件启动看看

论坛徽章:
0
7 [报告]
发表于 2008-09-01 18:05 |只看该作者
原帖由 cuci 于 2008-9-1 17:21 发表
这东西俺还没用过,只能给你点思路而已,就像你上面用的,指定配置文件启动看看


谢谢cuci大哥的指点
还是不行

莫非nginx启动不是这样启动的吗?
我试过nginx -c nginx.conf文件,进程中依然没有nginx的进程

谢谢大家的指点啦

论坛徽章:
0
8 [报告]
发表于 2008-09-01 19:57 |只看该作者
去pcre去下载 make install 一下就好吧

论坛徽章:
0
9 [报告]
发表于 2009-01-05 11:40 |只看该作者
原帖由 ppiqq 于 2008-9-1 17:09 发表
还有就是我换成0.6版本的话 编译没有问题,但是make 的时候报错信息如下:
cd /usr/include/pcre/ \
&& make libpcre.la
make[2]: Entering directory `/usr/include/pcre'
make[2]: *** No rule to make t ...


如下试一下看看
mkdir -p /usr/include/pcre/.libs
cp /usr/lib/libpcre.a /usr/include/pcre/libpcre.a
cp /usr/lib/libpcre.a /usr/include/pcre/libpcre.la
cp /usr/lib/libpcre.a /usr/include/pcre/.libs/libpcre.a
cp /usr/lib/libpcre.a /usr/include/pcre/.libs/libpcre.la
然后再make;make install
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP