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 # 查看版本
  • 相关阅读:
    Nginx 301重定向域名
    linux中set的用法
    Linux下Oracle中SqlPlus时上下左右键乱码问题的解决办法
    PLSQL Developer连接远程oracle配置
    linux vnc 安装
    关于innodb_thread_concurrency参数 并发控制
    MySQL auto_increment的坑
    MongoDB常用操作命令大全
    MySQL集群Percona XtraDB Cluster安装搭建步骤详解
    3台服务器Redis高可用哨兵模式实现(转)
  • 原文地址:https://www.cnblogs.com/TaleG/p/5352335.html
Copyright © 2011-2022 走看看