1.安装说明: 系统环境:CentOS-4.0 2.依赖的程序
(1). gzip module requires zlib library 3.依赖程序的安装有两种方法:一种是下载包安装二是YUM一次性安装
(1)zlib安装 (4)nginx安装
下载地址:http://nginx.org/download/
官网下载地址:http://www.nginx.org/ 4.配置(很重要)
#修改防火墙配置: [root@bogon nginx-0.8.4]# vi + /etc/sysconfig/iptables #添加配置项 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #重启防火墙 [root@bogon nginx-0.8.4]# service iptables restart
5.启动:
#方法1 [root@bogon nginx-0.8.4]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf #方法2 [root@bogon nginx-0.8.4]# cd /usr/local/nginx/sbin [root@bogon sbin]# ./nginx
6.停止:
#查询nginx主进程号 ps -ef | grep nginx #停止进程 kill -QUIT 主进程号 #快速停止 kill -TERM 主进程号 #强制停止 pkill -9 nginx
7.测试:
#测试端口 netstat –na|grep 80 #浏览器中测试 http://127.0.0.1:80
8.注意问题:
复制代码代码如下:
[root@bogon 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()
#netstat -nptl //查看80端口已被使用 (责任编辑:IT) |