一、nginx的编译安装
1、下载源码包
到官网复制源码包的链接地址
[root@myp ~]# wget http://nginx.org/download/nginx-1.12.1.tar.gz
[root@myp ~]# ls (可以查看到下载的安装包)
2、解压
[root@myp ~]# tar xf nginx-1.12.1.tar.gz
3、编译并安装(如果之前用了其他方式安装了nginx,先停掉nginx -s stop)
[root@bogon ~]# cd nginx-1.12.1
[root@bogon nginx-1.12.1]# ./configure --prefix=/usr/local/nginx
(/usr/local/nginx这个目录之前是没有的)
但是由于还没有安装一些依赖工具,会有以下提示
./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.
【意思是说http服务(nginx提供的就是http服务)中的重写功能需要pcre库的支持,如果需要这个功能就要下载pcre库,不然就加–without-http_rewrite_module这个选项来禁用http的重写功能】
但是安装pcre的时候发现又有依赖的工具。所以一下子把nginx依赖的工具都安装了吧
yum install mysql php php-fpm pcre-devel openssl-devel gcc automake zlib-devel
automake:http://www.cnblogs.com/ericdream/archive/2011/12/09/2282359.html(可以参考这篇文章,牵扯到的东西还是挺多的)