Installation Environment Preparation
1, gcc compiler yum install gcc apt-get install gcc 2, PCRE Library (Perl-compatible regular expressions), to support regular PCRE provide static or dynamic library Pcre-devel provide development header files and source Code yum install pcre pcre-devel apt-get install libpcre3 libpcre3-dev 3, zlib Library (gzip archive for HTTP return compression use) Yum Insta ll zlib zlib-devel apt-get install zlib1g Zlib1g-dev 4, OpenSSL (only required when using HTTPS) yum install OpenSSL openssl-devel apt-get Install OpenSSL Openssl-dev
download code and install1, download source wget http://nginx.org/download/nginx-1.6.0.tar.gz 2, unzip the source tar zxvf nginx-1.6.0.tar.gz CD nginx-1.6.0 3, installation configuration./co nfigure--help: View optional configuration items./configure--user=nginx--group=nginx--prefix=/usr/local/nginx-1.6.0 4, compiling and installing make make install 5, check the configuration file and start sudo/usr/local/nginx-1.6.0/sbin/nginx-t Check the configuration file is correct Sudo/usr/local/nginx-1.6.0/sbin/nginx sudo netst AT-NPL | grep Nginx Checks if the port is started successfully Curl http://localhost/check HTTP request is normal 6, stop, restart, reload Nginx sudo/usr/local/nginx-1.6.0/sbin/ng Inx-s stop immediately stop Nginx Sudo/usr/local/nginx-1.6.0/sbin/nginx-s quit calmly stop nginx, waiting for the end of the request has been sudo/usr/local/nginx- 1.6.0/sbin/nginx-s reopen from new open log file Sudo/usr/local/nginx-1.6.0/sbin/nginx-s reload from new load profile abnormal stop kill-9 ngin Xpid killall nginx 7, edit nginx start service script/etc/init.d/nginx
#! /bin/SH# Author:ryan Norbauer http://norbauerinc.com# Modified:geoffrey Grosenbach http://topfunky.com# Modified:clement nedelcu# reproduced with express authorization from its contributors Set–epath=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/Bindesc="nginx Daemon"NAME=Nginxdaemon=/usr/local/nginx-1.6.0/sbin/$NAMESCRIPTNAME=/etc/init.d/$NAME # If the daemonfileis not found, terminate the Script.test-X $DAEMON | | Exit0D_start () {$DAEMON||Echo-N"already running"}d_stop () {$DAEMON –s quit||Echo-N"Not running"}d_reload () {$DAEMON –s reload||Echo-N"could not reload"} Case " $" inchstart)Echo-N"starting $DESC: $NAME"D_startEcho "." ;; Stop)Echo-N"stopping $DESC: $NAME"D_stopEcho "." ;; Reload)Echo-N"Reloading $DESC Configuration ..."D_reloadEcho "Reloaded." ;; Restart)Echo-N"restarting $DESC: $NAME"D_stop # Sleep forseconds before starting again, this should give the # Nginx daemon some TimeTo perform a graceful stop. Sleep 2D_startEcho "." ;; *) Echo "Usage: $SCRIPTNAME {start|stop|restart|reload}">&2Exit3 ;;EsacExit0
8, modify the Nginx start service script permissions sudo chomd A+x/etc/init.d/nginx 9, start, close, Reload Nginx service services nginx start service Nginx stop service Nginx Reopen service Nginx reload 10, installation Nginx services update-rc.d-f nginx defaults Debian series Chkconfig--add Nginx Red -hat Series
Nginx installation Process