1. Install PCRE before installing nginx.
# Tar zxvf pcre-8.12.tar.gz
#./Configure
# Make
# Make install
Ii. Install nginx
# Tar zxvf nginx-1.0.7.tar.gz
#./Configure -- prefix =/usr/local/nginx
# Make
# Make install
Iii. nginx Startup Script
VI/etc/init. d/nginx
Enter the following content
#! /Bin/sh
#
# Nginx-this script starts and stops the nginx daemin
#
# Chkconfig:-85 15
# Description: nginx is an HTTP (s) server, HTTP (s) reverse \
# Proxy and IMAP/POP3 Proxy Server
# Processname: nginx
# Config:/usr/local/nginx/CONF/nginx. conf
# Pidfile:/usr/local/nginx/logs/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)
Nginx_conf_file = "/usr/local/nginx/CONF/nginx. conf"
Lockfile =/var/lock/subsys/nginx
Start (){
[-X $ nginx] | Exit 5
[-F $ nginx_conf_file] | exit 6
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
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 (){
Status $ prog
}
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
4. Add auto start
# Chmod + x/etc/init. d/nginx
#/Sbin/chkconfig nginx on
# Service nginx start
Install lnmp with source code