zoukankan      html  css  js  c++  java
  • nginx编译安装

    nginx编译安装
    下载安装包 nginx-1.3.15.tar.gz
     
      tar zxvf nginx-1.3.15.tar.gz
      cd nginx-1.3.15/
     
      
    进行编译
        ./configure --user=www --group=www --prefix=/usr/local/nginx  
        --with-http_stub_status_module --with-http_ssl_module
     
    make && make install
     
     
    遇到的问题
     
    • ./configure: error: C compiler cc is not found
          解决方法:yum -y install gcc 
    •   安装GCC后再次运行
    ./configure --user=www --group=www --prefix=/usr/local/nginx  
        --with-http_stub_status_module --with-http_ssl_module
    报错:

    hecking for PCRE library ... not found

    checking for PCRE library in /usr/local/ ... not found
    checking for PCRE library in /usr/include/pcre/ ... not found
    checking for PCRE library in /usr/pkg/ ... not found
    checking for PCRE library in /opt/local/ ... not found

    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.

    解决方法:yum -y install pcre-devel

    • 再次运行
    ./configure --user=www --group=www --prefix=/usr/local/nginx  
        --with-http_stub_status_module --with-http_ssl_module

    报错:

    checking for PCRE JIT support ... not found
    checking for OpenSSL library ... not found

    ./configure: error: SSL modules require the OpenSSL library.
    You can either do not enable the modules, or install the OpenSSL library
    into the system, or build the OpenSSL library statically from the source
    with nginx by using --with-openssl=<path> option.

    解决方法:yum -y install openssl openssl-devel

     最后运行

    ./configure --user=www --group=www --prefix=/usr/local/nginx  
        --with-http_stub_status_module --with-http_ssl_module
     
    make && make install
     

    安装完毕后用/usr/local/nigix/sbin/

    启动nginx     #./nginx 

    启动nginx2    /usr/local/nginx/sbin/nginx

    遇到的问题

    启动nginx报nginx: [emerg] getpwnam("www") failed

    在nginx.conf中 把user nobody的注释去掉既可

    检查是否启动成功:

    netstat -ano|grep 80 有结果输入说明启动成功

      打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功 

    ps:注意:此处需要关闭防火墙 service iptables stop

    重启

    /usr/local/nginx/sbin/nginx –s reload

    或者 killall -HUP nginx

    参考链接:http://www.cnblogs.com/zhuhongbao/archive/2013/06/04/3118061.html

  • 相关阅读:
    Android深入四大组件(九)Content Provider的启动过程
    mysql启动时报错:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid) 的解决方法
    定制rpm包-Yum环境搭建
    FPM定制RPM包实践
    nginx服务企业应用
    keepalived中的脑裂
    Linux 进程后台运行的几种方式(screen)
    ansible服务部署与使用
    HTTP服务原理
    KICKSTART无人值守安装
  • 原文地址:https://www.cnblogs.com/AliceAn/p/4225349.html
Copyright © 2011-2022 走看看