nginx 编译安装

1、nginx编译安装

useradd nginx -s /sbin/nologin

yum install zlib zlib-devel pcre* openssl*

 

./configure --prefix=/data/svr/nginx1.9.1 --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_gzip_static_module

–with-http_stub_status_module:支持nginx状态查询
–with-http_ssl_module:支持https
–with-http_spdy_module:支持google的spdy,想了解请百度spdy,这个必须有ssl的支持
–with-pcre:为了支持rewrite重写功能,需要使用正则匹配,必须支持pcre

如果上面编译没有报错,就可以安装了

make  && make install

 

 

2、nginx 编译参数详解

./configure --prefix=/data/svr/nginx1.9.1 --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_gzip_static_module
nginx 编译参数

 

 

3、nignx 启动脚本

#!/bin/bash
# chkconfig: - 85 15
# description: Startup and shutdown script for nginx
# processname: nginx
# config:      /data/svr/nginx1.9.1/conf/nginx.conf
# pidfile:     /data/svr/nginx1.9.1/logs/nginx.pid 

NGINX_DIR=/data/svr/nginx1.9.1
export NGINX_DIR

case $1 in
'start' )
echo "Starting nginx..."
$NGINX_DIR/sbin/nginx
;;
'reload' )
echo "Reload nginx configuration..."
kill -HUP `cat $NGINX_DIR/logs/nginx.pid`
;;
'stop' )
echo "Stopping nginx..."
kill -15 `cat $NGINX_DIR/logs/nginx.pid`
;;
'list' )
ps aux | egrep '(PID|nginx)'
;;
'testconfig' )
$NGINX_DIR/sbin/nginx -t
;;
*)
echo "usage: `basename $0` {start|reload|stop|list|testconfig}"
esac
启动脚本

 

posted @ 2016-07-13 14:04  wawahan  阅读(106)  评论(0)    收藏  举报