Version: nginx-1.8.0.tar.gz official website: http://nginx.org/en/download.html version: apache-tomcat-6.0.44.tar.gz official website:/http TOMCAT.APACHE.ORG/1, Installation script: # yum Clean all # yum makecache# Yum Update # yum install wget# wget-c http://nginx.org/download/nginx-1.7.9.tar.gz # F Ind-name nginx# Yum Remove nginx # cd/Download Catalog # tar-zxv-f nginx-1.7.9.tar.gz # RM-RF nginx-1.7.9.tar.gz# MV nginx-1.7.9 /usr/local/nginx # yum Install gcc-c++
# yum-y Install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel # cd/usr/local/nginx#./configure--prefix=/usr/l Ocal/nginx--conf-path=/usr/local/nginx/nginx.conf# make && make install 2, start/restart/stop/ Start: #/usr/local/nginx/sbin/nginx Restart: #/usr/local/nginx/sbin/nginx-s ReloadStop: #查询nginx主进程号: Ps-ef | grep nginx# Stop process: kill-quit main process number
#快速停止: kill-term Main process number
#强制停止: pkill-9 nginx 3, boot start, start script
1, write boot script, in/etc/init.d/directory: Vi/etc/init.d/nginx
2. Change script permissions: chmod 775/etc/init.d/nginx or: chmod a+x/etc/init.d/nginx (a+x ==> all user can execute)
3, write the script content: #################################!/bin/bash# nginx Startup script for the Nginx HTTP server# it is v.0.0.2 versi on.# chkconfig:-15# Description:nginx is a high-performance web and proxy server.# It had a lot of feat Ures, but it's not for everyone.# Processname:nginx# Pidfile:/var/run/nginx.pid# config:/usr/local/nginx/conf/nginx.confNginxd=/usr/local/nginx/sbin/nginxnginx_config=/usr/local/nginx/conf/nginx.confNginx_pid=/var/run/nginx.pidRetval=0prog= "Nginx" # Source function library. /etc/rc.d/init.d/functions# Source Networking configuration: /etc/sysconfig/network# Check that networking are up. [${networking} = "No"] && exit 0[-x $nginxd] | | Exit 0# Start Nginx daemons Functions.start () {If [-e $nginx _pid];then echo "Nginx already running ...." &NBSP ; exit 1fi echo-n $ "Starting $prog:" daemon $nginxd-C ${nginx_config} retval=$ ? echo [$RETVAL = 0] && touch/var/lock/subsys/nginx return $RETVAL}# Stop N Ginx daemons functions.stop () { ECHO-N $ "stopping $prog:" Killproc $nginxd retval=$? echo [$RETVAL = 0] & amp;& rm-f/var/lock/subsys/nginx/var/run/nginx.pid}# Reload Nginx service functions.reload () { Echo-n $ "Reloading $prog:" #kill-hup ' Cat ${nginx_pid} ' Killproc $nginxd-hup retval=$? echo}# See how we were CALLED.C ASE "$" instart) start ;; Stop) stop ;; Reload) reload ;; Restart) stop start ;; Status) status $prog retval=$? ;; *) echo $ "Usage: $prog {start|stop|restart|reload|status|help}" Exi T 1esacexit $RETVAL ####################### 4, set boot start: Chkconfig nginx on or: Vi/etc/rc.local join a row/etc/init.d/nginx Start save and exit and the next reboot will take effect. 5, so in the console is very easy to operate Nginx: view Nginx current status, start Nginx, stop nginx, restart Nginx.../etc/init.d/nginx status/etc/init.d/nginx start/ Etc/init.d/nginx Stop/etc/init.d/nginx restart 4, nginx Load balancer configuration: Cluster TOMCAT Windows directly decompression, click Nginx.exe to start, the common command is as follows (. exe can be removed) "This is the background operation, Windows Nginx does not register the system services, need to rely on third-party tools to process the registry information is more complex;": cd Nginx Directory ; start: Nginx.exe or Double-click Stop: nginx.exe-s stop reload: nginx.exe-s Reload exit: Nginx.exe-s quit;
Nginx installation configuration + cluster Tomcat:centos and Windows environment