在/usr目录下执行命令下载最新Nginx源代码:
wget http://nginx.org/download/nginx-1.2.0.tar.gz
tar zxvf nginx-1.2.0.tar.gz
yum -y install pcre-devel
yum -y install openssl openssl-devel
./configure --prefix=/usr/nginx
creating objs/Makefile Configuration summary + using system PCRE library + OpenSSL library is not used + md5: using system crypto library + sha1: using system crypto library + using system zlib library nginx path prefix: "/usr/nginx" nginx binary file: "/usr/nginx/sbin/nginx" nginx configuration prefix: "/usr/nginx/conf" nginx configuration file: "/usr/nginx/conf/nginx.conf" nginx pid file: "/usr/nginx/logs/nginx.pid" nginx error log file: "/usr/nginx/logs/error.log" nginx http access log file: "/usr/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"
现在编译和安装:
make make install
如果要修改端口,修改/usr/nginx/conf/nginx.conf文件,比如:
server { listen 8081;