全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 19835|回复: 23
打印 上一主题 下一主题

centos 用啥命令开启 nginx 啊?

[复制链接]
跳转到指定楼层
1#
发表于 2010-5-27 15:55:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
开启MYSQL:/etc/rc.d/init.d/mysql start
开启ssh:/etc/init.d/ssh start
开启php :/usr/local/php/sbin/php-fpm start

请问 怎么开启nginx ?
2#
发表于 2010-5-27 16:03:47 | 只看该作者
启动nginx:
/usr/local/nginx/sbin/nginx
3#
发表于 2010-5-27 16:04:17 | 只看该作者
/usr/local/nginx/sbin/nginx

就行
4#
 楼主| 发表于 2010-5-27 16:13:02 | 只看该作者

回复 2# 的帖子

[root@li96-51 ~]# nginx start
-bash: nginx: command not found

[root@li96-51 ~]# /usr/local/php/sbin/php-fpm start
Starting php_fpm  done

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx -s reload
[emerg]: open() "/usr/local/nginx/conf/fcgi.conf" failed (2: No such file or directory) in /usr/local/nginx/conf/nginx.conf:67

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx -s reopen
[emerg]: open() "/usr/local/nginx/conf/fcgi.conf" failed (2: No such file or directory) in /usr/local/nginx/conf/nginx.conf:67

[root@li96-51 ~]# killall -HUP nginx
nginx: no process killed

[root@li96-51 ~]# start nginx
-bash: start: command not found

[root@li96-51 ~]# nginx start
-bash: nginx: command not found

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx
[emerg]: open() "/usr/local/nginx/conf/fcgi.conf" failed (2: No such file or directory) in /usr/local/nginx/conf/nginx.conf:67

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx start
invalid option: "start"


说我这里没有 fcgi.conf
我这里有 fastcgi.conf  是不是复制一份fastcgi.conf 改名为 fcgi.conf 就可以了?
用大猫的 5月21号包

ps:兽兽 我email你买域名 还没回  [email protected]
5#
 楼主| 发表于 2010-5-27 16:19:02 | 只看该作者
根据错误提示 我把nginx里的挂在fcgi.conf 的一行删除了
后续几个提示中的error_page  我也删除了

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx -s reload
[emerg]: directive "error_page" is not terminated by ";" in /usr/local/nginx/conf/servers/bbsmessfeel.conf:11

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx
[emerg]: directive "error_page" is not terminated by ";" in /usr/local/nginx/conf/servers/bbsmessfeel.conf:11

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx
[emerg]: directive "error_page" is not terminated by ";" in /usr/local/nginx/conf/servers/wangjingcc.conf:11

[root@li96-51 ~]# /usr/local/nginx/sbin/nginx
[warn]: conflicting server name "www.wangjing.cc" on 0.0.0.0:80, ignored
[warn]: conflicting server name "wangjing.cc" on 0.0.0.0:80, ignored
6#
 楼主| 发表于 2010-5-27 16:20:48 | 只看该作者
我把wangjingcc的.conf 配置 删除后
还是不行

/usr/local/nginx/sbin/nginx
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: still could not bind()
7#
发表于 2010-5-27 16:22:14 | 只看该作者
nginx已经启动了吧..

启动nginx时先看看配置对不对

-bash-3.2# /usr/local/nginx/sbin/nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
8#
 楼主| 发表于 2010-5-27 16:22:24 | 只看该作者
用 /usr/local/nginx/sbin/nginx -s reopen
算是OK了
谢谢楼上两位 给的简单开启办法 让我知道哪里有错误 才导致我开不起nginx的 谢谢了
9#
 楼主| 发表于 2010-5-27 16:25:25 | 只看该作者
启动之前 无法使用 -t检测
现在启动后 是可以检测了!
/servers/下的配置 是按照你预留的imcat.conf 原样复制了一份 换成自己的域名了
这个域名可以使用
但是再复制一份的话 就不能启动了

# /usr/local/nginx/sbin/nginx -t
[warn]: conflicting server name "www.wangjing.cc" on 0.0.0.0:80, ignored
[warn]: conflicting server name "wangjing.cc" on 0.0.0.0:80, ignored
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful


wangjing.conf 配置如下

server

        {
                listen       80;
                server_name www.wangjing.cc wangjing.cc;
                index index.html index.htm index.php;
                root  /home/wangjing/;
                include location.conf;
        }
10#
发表于 2010-5-27 16:27:27 | 只看该作者
/servers/下

有2个wangjing.conf的配置文件吧...

你看看/servers/都有些什么文件
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-9-21 11:42 , Processed in 0.089135 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表