你的分享就是我们的动力 ---﹥

nginx在linux下安装

时间:2016-12-16 19:15来源:www.chengxuyuans.com 点击:
  1. 安装前先确认是否已经安装编译包和一些依赖包如果没有安装:

            yum install pcre*

            yum install openssl*

            yum install zlib 

            yum install zlib-devel

             yum install wget

        查看是否已经安装好 rpm -qa | grep "查看的内容"

      2.开始安装nginx

        wget http://nginx.org/download/nginx-1.8.0.tar.gz

     3. 解压

         如果你想把安装包复制到别处 可以  cp nginx-1.8.0.tar.gz  路径(例如/usr/local)

        tar -zxvf nginx-1.8.0.tar.gz

    4.解压完毕开始安装

      cd  nginx-1.8.0

       ./configure --prefix=/opt/nginx --with-http_stub_status_module // --prefix=/opt/nginx  这个是指定安装路径

 5.启动nginx 我这里安装在了opt/nginx

   cd /opt/nginx

   ./nginx //如果执行此步骤时出现端口被占用 :

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

  我这里是80端口被占用了查看哪些占用了80端口

   fuser -n tcp 80

  返回消息是80/tcp:              12965 12966

  然后通过 kill -9 删除进程

 kill -9 12965

 kill -9 12966

然后再启动nginx

./nginx

此文章是综合 http://happyqing.iteye.com/blog/1806561    http://jingyan.baidu.com/article/1974b2898f5eadf4b1f774de.html    http://www.laozuo.org/3510.html 实践总结出的 如果有什么错误联系作者

转载注明地址:http://www.chengxuyuans.com/Linux/105690.html