CentOS 6.5 minimal安装不再赘述
Nginx源码安装
1.安装wget下载程序
yum -y install wget
2.安装编译环境:gcc gcc-c++ automake autoconf libtool make
yum -y install gcc gcc-c++ automake autoconf libtool make
3.安装相关依赖包(目前采用的是源码安装,放置到源码目录,也可使用其他如yum方式安装):
PCRE库(用于支持http rewrite)
cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz tar zxvf pcre-8.37.tar.gz cd pcre-8.37 ./configure make make install
zlib库(用于支持http gzip)
cd /usr/local/src wget http://zlib.net/zlib-1.2.8.tar.gz tar zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure make make install
4.创建下载文件存放的目录(后面下载的都放入此目录),并进入
cd /root mkdir download cd download
5.下载nginx源码包(v1.8.0)最近稳定版
wget http://nginx.org/download/nginx-1.8.0.tar.gz
6.解压、编译、安装(采用默认安装配置,但pcre的位置需要指定)
tar zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0 ./configure --with-pcre=/usr/local/src/pcre-8.37
make
make install
最终nginx的安装路径信息为:
Configuration summary + using PCRE library: /usr/local/src/pcre-8.37 + OpenSSL library is not used + using builtin md5 code + sha1 library is not found + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"