zoukankan      html  css  js  c++  java
  • Linux下源码安装Nginx服务

    nginx 安装

    linux 系统需要安装必备的开发包,比如 gcc,gcc-c++

        1. 

    openssl (支持 https)

    https://www.openssl.org/source/openssl-1.0.2.tar.gz

    tar -zxvf openssl-1.0.2.tar.gz # 下载并解压,然后 cd 到安装目录,下同

    ./config --prefix=/usr/local --openssldir=/usr/local/openssl
    
    make  
    make test make install 
        2. 

    pcre: (支持转发组件)

    ./configure 
    
    
    make 
    
    make install 
        3. 

    nginx:

    ./configure --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-openssl=/opt/package/openssl-1.0.2a
    
    
    make &&  make install 

    注意如果 ./configure 提示 error: the HTTP gzip module requires the zlib library... ,可以 yum -y install zlib-devel 或手动安装 zlib-devel,如果不需要此功能,可以在 ./configure 加上--without-http_gzip_module

    注意:--with-openssl=/usr/local/openssl 修改 openssl 压缩包的的解压目录,我的测试机为/opt/package/openssl-1.0.2a
    参考: 其它 nginx 常用编译选项 开启 http_realip_module 模块

    --with-http_realip_module  : nginx 代理后获取真实 ip,
    
    --with-http_stub_status_module --with-http_ssl_module  :支持 https 

    启动 nginx,

    cd /usr/local/nginx/sbin
    
    ./nginx  & 

    启动不报错说明 nginx已经正常运行

    解决 error while loading shared libraries: libpcre.so.1的错误
    /usr/local/webserver/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
    解决方法:

    ln -s /usr/local/lib/libpcre.so.1 /lib  /lib64 

    其它 nginx 命令参考

    nginx -t # 检查配置文件语法是否正确 nginx -s reload #重新加载修改后的配置文件 nginx -V # 查看编译参数 nignx -v # 查看版本
  • 相关阅读:
    自动清除firefox缓存
    2013年02月24日
    java Class类
    Learning by doing——获黄色领骑衫之感
    2017《面向对象程序设计》课程作业八
    2017《面向对象程序设计》课程作业七
    2017《面向对象程序设计》课程作业六
    2017《面向对象程序设计》课程作业五
    2017《面向对象程序设计》课程作业四
    2017《面向对象程序设计》课程作业三
  • 原文地址:https://www.cnblogs.com/TaleG/p/5352335.html
Copyright © 2011-2022 走看看