centos下安装nginx

本文详细记录了在 CentOS 系统上安装 Nginx 1.9.4 的过程,包括解决依赖问题、升级 Nginx 版本以及添加对 uWSGI 的支持。遇到的错误如 PCRE 库缺失和多线程不支持等问题,通过安装 pcre-devel 解决,并成功配置了 Nginx 的 aio threads 功能。同时,文章还介绍了如何使用 uwsgi 参数启动服务,并展示了 Nginx 的状态监控页面。
摘要由CSDN通过智能技术生成
centos下安装nginx


[root@iZ258gu0zkwZ tmp]# wget http://nginx.org/download/nginx-1.9.4.tar.gz
[root@iZ258gu0zkwZ tmp]# tar zxvf nginx-1.9.4.tar.gz 
[root@iZ258gu0zkwZ tmp]# cd nginx-1.9.4
[root@iZ258gu0zkwZ nginx-1.9.4]# ./configure --prefix=/opt/nginx --with-http_stub_status_module
出错:
./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,可提示已是最新版本:
[root@iZ258gu0zkwZ nginx-1.9.4]# yum install pcre
Loaded plugins: security
Setting up Install Process
Package pcre-6.6-9.el5.i386 already installed and latest version
Nothing to do


现在是需要1.7.11以上的支持多线程模型的nginx版本,直接用yum查看nginx版本是0.8几,如下处理:
[root@iZ258gu0zkwZ nginx-1.9.4]# rpm -ivh http://nginx.org/packages/centos/5/i386/RPMS/nginx-1.8.0-1.el5.ngx.i386.rpm 
Retrieving http://nginx.org/packages/centos/5/i386/RPMS/nginx-1.8.0-1.el5.ngx.i386.rpm
warning: /var/tmp/rpm-xfer.Zua6AN: Header V3 RSA/SHA1 signature: NOKEY, key ID 7bd9bf62
Preparing...                ########################################### [100%]
   1:nginx                  ########################################### [100%]
----------------------------------------------------------------------


Thanks for using nginx!


Please find the official documentation for nginx here:
* http://nginx.org/en/docs/


Commercial subscriptions for nginx are available on:
* http://nginx.com/products/


----------------------------------------------------------------------
[root@iZ258gu0zkwZ nginx-1.9.4]# yum info nginx
Loaded plugins: security
Installed Packages
Name       : nginx
Arch       : i386
Version    : 1.8.0
Release    : 1.el5.ngx
Size       : 746 k
Repo       : installed
Summary    : High performance web server
URL        : http://nginx.org/
License    : 2-clause BSD-like license
Description: nginx [engine x] is an HTTP and reverse proxy server, as well as
           : a mail proxy server.




再执行安装:
[root@iZ258gu0zkwZ nginx-1.9.4]# yum install nginx
Loaded plugins: security
Setting up Install Process
Package matching nginx-0.8.55-6.el5.i386 already installed. Checking for update.
N
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值