linux安装nginx

来源:互联网 发布:c语言辅导 编辑:程序博客网 时间:2024/05/22 01:56
1. 安装GCC编译器  yum -y install gcc gcc-c++ autoconfig automake
1.2. nginx的一些模块需要第三方库的支持,如:zlib、pcre、openssl、openssl-devel、pcre、pcre-devel等;
      yum -y install zlib pcre openssl openssl-devel pcre pcre-devel
1.3.  检查系统是否安装了nginx,命令:find -name nginx;如果有,卸载:yum remove nginx;
1.4. 下载nginx;http://nginx.org/      
1.5.  上传安装包至linux服务器;
1.6. 安装
       #tar zxvf nginx-1.6.2.tar.gz
      #cd nginx-1.6.2
      #./configure --prefix=/usr/local/nginx
      #make
      #make install
7.  配置防火墙,打开80端口,在 /etc/sysconfig/iptables 添加如下内容:
      -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT;
8.  启动
      #/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
      #cd /usr/local/nginx/sbin;
      #./nginx
9.  测试是否启动成功
      #netstat -na | grep 80
      #http:ip:80 (浏览器)
10. 重启
      #./nginx -s reload
11. 停止nginx
      #./nginx -s stop
0 0
原创粉丝点击