nginx安装配置
nginx安装配置
jackmanwu 发表于3个月前
nginx安装配置
  • 发表于 3个月前
  • 阅读 1
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

摘要: 运维

nginx安装配置

  • 下载
    wget -c https://nginx.org/download/nginx-1.12.1.tar.gz
    
  • 安装
    • 解压
    tar -zxvf nginx-1.12.1
    
    • 配置(采用的都是默认配置,详细配置可查询nginx官网)
    ./configure
    
    执行完报错如下
    ./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.
    
    缺少pcre包,安装pcre包
    yum -y install pcre-devel
    
    再次执行nginx配置
    ./configure
    
    执行完后再次报错如下
    ./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using --without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib library
    statically from the source with nginx by using --with-zlib=<path> option.
    
    缺少zlib包,安装zlib包
    yum -y install zlib zlib-devel
    
    再次执行nginx配置
    ./configure --with-http_ssl_module 
    
    执行完后报错
    ./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.
    
    缺少OpenSSL包,安装该包
    yum -y install openssl openssl-devel
    
    再次执行nginx配置
    ./configure --with-http_ssl_module
    
    不再报错,执行成功
    • 编译
    make
    
    • 安装
      make install
      
  • 测试
    ps -ef|grep nginx
    
    如下运行成功
    root     28023     1  0 15:36 ?        00:00:00 nginx: master process ./sbin/nginx -c conf/nginx.conf
    nobody   28024 28023  0 15:36 ?        00:00:00 nginx: worker process
    root     28717 15784  0 15:45 pts/1    00:00:00 grep --color=auto nginx
    
    开放端口80
    firewall-cmd --add-port=80/tcp --permanent
    firewall-cmd --reload
    
    页面显示
    Welcome to nginx!
共有 人打赏支持
粉丝 0
博文 7
码字总数 1760
×
jackmanwu
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: