确保安装了 gcc,openssl-devel,pcre-devel,zilb-devel
下载官网:http://nginx.org/
[root@localhost tools]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
--2017-10-21 10:43:52-- http://nginx.org/download/nginx-1.6.3.tar.gz
Resolving nginx.org... 95.211.80.227, 206.251.255.63, 2001:1af8:4060:a004:21::e3, ...
Connecting to nginx.org|95.211.80.227|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://101.247.192.67/files/32230000052D57CD/nginx.org/download/nginx-1.6.3.tar
.gz [following]--2017-10-21 10:43:53-- http://101.247.192.67/files/32230000052D57CD/nginx.org/download/
nginx-1.6.3.tar.gzConnecting to 101.247.192.67:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 805253 (786K) [application/octet-stream]
Saving to: “nginx-1.6.3.tar.gz”
100%[===============================================>] 805,253 840K/s in 0.9s
2017-10-21 10:43:54 (840 KB/s) - “nginx-1.6.3.tar.gz” saved [805253/805253]
[root@localhost tools]# ls
nginx-1.6.3.tar.gz
[root@localhost tools]# mkdir -p /application/nginx
[root@localhost tools]# ls
nginx-1.6.3.tar.gz
[root@localhost tools]# tar -zxf nginx-1.6.3.tar.gz
[root@localhost tools]# ls
nginx-1.6.3 nginx-1.6.3.tar.gz
[root@localhost tools]# cd nginx-1.6.3
[root@localhost nginx-1.6.3]# useradd nginx -s /sbin/nologin -M
[root@localhost nginx-1.6.3]# ./configure
> --with-http_stub_status_module
> --prefix=/application/nginx
> --with-http_gzip_static_module
> --user=nginx
> --group=nginx
[root@localhost nginx-1.6.3]# make&&make install
[root@localhost nginx]# ln -s /application/nginx /application/nginx-1.6.3
[root@localhost application]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx/conf/nginx.conf test is successful
[root@localhost application]# /application/nginx/sbin/nginx
[root@localhost /]# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 6125 root 6u IPv4 22127 0t0 TCP *:http (LISTEN)
nginx 6126 nginx 6u IPv4 22127 0t0 TCP *:http (LISTEN)
#--with-http_stub_status_module 可以启用 nginx 的 nginxstauts 功能,以监控 nginx 当前状态