1.下载nginx -1.2.5.tar.gz www.nginx.org/en/download.html tar -zxvf nginx -1.2.5.tar.gz
2. 编译工具 #yum -y install gcc gcc-c++ autoconf automake
#yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
zlib : nginx 提供gzip 模块,需要zlib 库支持 。 pcre :支持地址重写rewrite 功能。
3. 建用户:groupadd -r nginx useradd -s /sbin/nologin -g nginx -r nginx
4. 编译安装: tar -zxvf nginx-1.2.5tar.gz
cd nginx-1.2.5tar.gz
./configure --prerix=/usr --sbin-path=/usr/sbin/nginx --config-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock
--user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
--http-log-path=/var/log/nginx/access.log --http-clinet-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --with-http_stub_status_module
#make && make install
5.启动 mkdir /var/tmp/nginx/client -pv
/usr/sbin/nginx -c /etc/nginx/nginx.conf
检测:ps aux | grep nginx netstat -tulnp |grep :80
停止 : kill -quit $(cat /var/run/nginx/nginx.pid) 从容关闭quit
kill -TERM $(cat /var/run/nginx/nginx.pid) 快速停止
kill -9 nginx 强制关闭
6.加启动 cp nginx /etc/init.d/
chmod a+x /etc/init.d/nginx
chkconfig --add nginx chkconfig --list nginx
启动 service nginx restart