标签:
--prefix=/usr/local/nginx ==>安装部署后的根目录,默认为/usr/local/nginx--conf-path=/etc/nginx/nginx/nginx.conf ==>配置文件的放置路径,默认<prefix>/conf/nginx.conf--user=nginx ==>指定worker进程运行时所属的用户--group=nginx ==>指定worker进程运行是所属的组--error-log-path=/var/log/nginx/errpr.log ==>error日志放置位置--http-log-path=/var/log/nginx/access.log ==>access日志放置的位置--pid-path=/var/run/nginx/nginx.pid ==>pid文件的存放路径;默认<prefix>/logs/nginx.pid--lock-path=/var/lock/nginx.lock ==>lock文件的放置路径;默认<prefix>/logs/nginx.lock--with-http_ssl_module ==>提供HTTPS服务;该模块的安装依赖于OpenSSL开源软件--with-http_stub_status_module ==>能够获取Nginx自上次启动以来的工作状态--with-http_gzip_static_module ==> 如果采用gzip 模块把一些文档进行gzip 格式压缩后再返回给客户端,那么对同一个文件每次都会重新压缩,这是比较消耗服务器CPU 资源的. gzip static 模块可以在做gzip 压缩前,先查看相同位置是否有已经做过gzip 压缩的.gz 文件,如果有,就直接返回。这样就可以预先在服务器上做好文档的压缩,给CPU 减负--wiht-http_flv_modle ==>可以在向客户端返回响应肘,对FLV 格式的视频文件在header 头做一些处理,使得客户端可以观看、拖动FLV 视频--with-http_mp4_module ==>使客户端可以观看、拖动MP4 视频--http-client-body-temp-path=/var/tmp/nginx/client ==>set path to store http client request body temporary files--http-proxy-temp-path=/var/tmp/nginx/proxy ==>Nginx 作为HTTP 反向代理服务器时,上游服务器产生的HTTP 包体在需要临时存放到磁盘文件时,这样的临时文件将放到该路径下;默认<prefix>/proxy _temp--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi ==>Fastcgi 所使用临时文件的放置目;默认<prefix>/fastcgi_temp
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
./etc/rc.d/init.d/functions
# Source networking configuration.
./etc/sysconfig/network
# Check that networking is up.
["$NETWORKING"="no"]&& exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
pidfile="/var/run/nginx/nginx.pid"
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
[-f /etc/sysconfig/nginx ]&&./etc/sysconfig/nginx
lockfile=/var/lock/nginx.lock
make_dirs(){
# make required directories
options=`$nginx -V 2>&1 | grep ‘configure arguments:‘`
for opt in $options;do
if[`echo $opt | grep ‘.*-temp-path‘`];then
value=`echo $opt | cut -d "=" -f 2`
if[!-d "$value"];then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start(){
[-x $nginx ]|| exit 5
[-f $NGINX_CONF_FILE ]|| exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0]&& touch $lockfile
return $retval
}
stop(){
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0]&& rm -f $lockfile
return $retval
}
restart(){
configtest ||return $?
stop
sleep 1
start
}
reload(){
configtest ||return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload(){
restart
}
configtest(){
$nginx -t -c $NGINX_CONF_FILE
}
rh_status(){
rh_status_q(){
rh_status >/dev/null 2>&1
}
case"$1"in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
add_header name value [always];
expires
标签:
原文地址:http://www.cnblogs.com/kwstars/p/994f548db590b28ad716492c45db8d40.html