Nginx+Tomcat动静分离及Nginx优化(企业案例)(2)

[root@localhost ~]# vi /etc/init.d/nginx
#!/bin/bash
# chkconfig: 345 99 20
# description: Nginx servicecontrol script
PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case "$1" in
start)
$PROG
echo "Nginx servicestart success."
;;
stop)
kill -s QUIT $(cat $PIDF)
echo "Nginx service stopsuccess."
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIDF)
echo"reload Nginx configsuccess."
;;
*)
echo "Usage: $0{start|stop|restart|reload}"
exit 1
esac


[root@localhost ~]# chmod +x/etc/init.d/nginx
[root@localhost ~]# service nginx restart
[root@localhost ~]# chkconfig --add nginx
[root@localhost ~]# chkconfig nginx on

Nginx 的详细介绍请点这里
Nginx 的下载地址请点这里

推荐阅读

Nginx实现反向代理和负载均衡的配置及优化

Nginx做负载均衡报:nginx: [emerg] could not build the types_hash

Nginx 负载均衡模块 ngx_http_upstream_module 详述

Nginx+Firebug 让浏览器告诉你负载均衡将请求分到了哪台服务器

Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建)

Nginx+Tomcat动静分离搭建

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/026fcdc9afde700d811f82eb84faf3d7.html