1. Official: http://nginx.org/download/nginx-1.6.0.tar.gz
One: Nginx
0.
Yum Install gcc gcc-c++
Yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel
Yum-y Install Perl-devel perl-extutils-embed
Yum-y install gcc automake autoconf libtool make
Yum Install Pcre
Pcre Regular Expression Library
1. wget http://nginx.org/download/nginx-1.6.0.tar.gz
2. Tar zxvf nginx-1.6.0.tar.gz
3. CD nginx-1.6.0
4../configure–help View Help file--prefix=path
4../configure
5.make && make Install
/usr/local/nginx is already installed by default, the configuration file under ... conf,. Default is backed up
6. Start/usr/local/nginx/sbin/nginx
7. Open the 80 port of the firewall
Vi/etc/sysconfig/iptables
1. Modify the Vi/etc/sysconfig/iptables command to add a firewall open 80 port
2. Turn off/On/restart the firewall
3. Permanently shut down the firewall
8. Test, browser open IP, see nginx first page
Two: PHP
0.
Yum-y install gcc automake autoconf libtool makeyum-y install gcc gcc-c++ glibcyum-y install libmcrypt-devel Mhash-deve L libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel GL IBC glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs e2fsprogs-devel krb5 k Rb5-devel libidn libidn-devel OpenSSL openssl-devel
1. Download wget http://cn2.php.net/get/php-5.3.28.tar.gz/from/this/mirror
2. Tar zxvf Mirror
3.CD php5.3.28
3../configure–help prefix Apache module APXS enable–fpm
3../configure--prefix=/usr/local/php--ENABLE-FPM
4.make && make Install
5.php configuration file generation
CP Php-fpm.conf.default php-fpm.conf
6. Run PHP./sbin/php-fpm
7. View the process
PS Aux|grep php
Three: Integrate PHP and Nginx
PHP Port: 9000
1.vi/usr/local/nginx/conf/nginx.conf
Set Nu
2.65 lines, remove comments
3.69 Line:/scripts change to $document _root
4. Test the configuration file
/usr/local/nginx/sbin/nginx–t
5. Restart
/usr/local/nginx/sbin/nginx–s Reload
Four: Nginx signal control
Quti Graceful shut-off
HUP Modify configuration file, smooth restart
Kill–hub 4873//Process number PS Aux|grep Nginx
Nginx's signal control
term, INT |
Quick shutdown |
QUIT |
Graceful Shutdown graceful Closing process, that is, wait until the request is over and then close |
HUP |
Configuration Reloadstart The new worker processes with A new configurationgracefully shutdown the old worker processes Change profile, smooth reread configuration file |
USR1 |
Reopen the log files reread logs, useful when the log is split by month/day |
USR2 |
Upgrade executable on the fly smooth upgrade |
WINCH |
Gracefully shutdown The worker processes gracefully closes the old process (with USR2 to upgrade) |
Specific syntax:
Kill-The main process number of the signal option Nginx
Kill-hup 4873
Kill-Signal control ' cat/xxx/path/log/nginx.pid '
V: Virtual Hosting
Nginx Configuration Segment
Event {
Typically configure Nginx process and connection features
Working at the same time as several
Worker_connections 1024; This refers to the maximum number of connections that a child process allows to connect to 1024
}
HTTP {//This is the primary segment of the configuration HTTP server
Server1 {//This is a virtual host segment
Location {//Locate, place a special path or file again, such as image directory processing separately
}///AS. PHP is handled separately
}
Server2 {
}
}
Example 1: domain-based virtual host
server {
Listen 80; #监听端口
server_name a.com; #监听域名
Location/{
root/var/www/a.com; #根目录定位
Index index.html;
}
}
Example 2: Port-based virtual host configuration
server {
Listen 8080;
server_name 192.168.1.204;
Location/{
root/var/www/html8080;
Index index.html;
}
}
2. Kill Process pkill–9 Nginx pkill-9 php-fpm rm–rf nginx rm–rf php