Compile and configure the Nginx Load Balancing optimization plug-in
1. Install the Ngix dependency Module
Ngix depends on the following modules: pcre, zlib, openssl, md5/sha1 (if the corresponding modules are not installed in the system, install them as follows)
1. Install the pcre module (8.35)
Http://www.pcre.org/
Installation command:
# Unzip pcre-8.35.zip
# Cd pcre-8.35
#./Configure
# Make & make install
In a 64-bit linux system, the library location searched by nginx is lib64. Therefore, you need to establish a soft connection:
# Ln-s/usr/local/lib/libpcre. so.1/lib64/
# Ln-s/usr/local/lib/libpcre. so.1/lib/
# Ln-s/usr/local/lib/libpcre. so.1/usr/local/lib64/
2. Install the zlib module (1.2.8)
Http://www.zlib.net/
Installation command:
# Tar zxvf zlib-1.2.8.tar.gz
# Cd zlib-1.2.8
#./Configure
# Make & make install
3. Install the openssl module (1.0.1h)
Http://www.openssl.org/
Installation command:
# Tar zxvf openssl-1.0.1h.tar.gz
# Cd openssl-1.0.1h
#./Config
# Make & make install
4. decompress the Nginx plug-in
1) nginx_upstream_hash plug-in
Load Balancing Hash policy plug-in.
Https://github.com/evanmiller/nginx_upstream_hash
# Unzip nginx_upstream_hash-master.zip
2) nginx-sticky-module plug-in
Server Load balancer is a cooki-based session bonding plug-in. Reverse Proxy Sessions direct to the same backend server. Note: The source code downloaded from the official website is incorrectly compiled in line 295 of ngx_http_sticky_module.c. You need to put ngx_http_sticky_srv_conf_t * conf = iphp-> sticky_conf in line 295th.
Https://github.com/yaoweibin/nginx-sticky-module
# Unzip nginx-sticky-module-master.zip
3) ngx_pagespeed plug-in
Front-end webpage access speed-up optimization plug-in.
Https://github.com/pagespeed/ngx_pagespeed
Https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz
# Unzip ngx_pagespeed-master.zip
# Cp 1.8.31.4.tar.gz./ngx_pagespeed-master
# Cd ngx_pagespeed-master
# Tar-xzvf 1.8.31.4.tar.gz
Ii. Install Nginx
1. Install Nginx (1.6.0)
Http://nginx.org/
Installation command:
# Tar zxvf nginx-1.6.0.tar.gz
# Cd nginx-1.6.0
#./Configure -- user = TSP \
-- Prefix =/usr/local/nginx \
With-http_ssl_module \
With-http_stub_status_module \
With-http_realip_module \
-- Add-module =/home/TSP/nginx/plugin/nginx_upstream_hash-master \
-- Add-module =/home/TSP/nginx/plugin/nginx-sticky-module-master \
-- Add-module =/home/TSP/nginx/plugin/ngx_pagespeed-master
# Make & make install
The Nginx directory structure after installation is complete:
[Root @ AP nginx-1.6.0] # ll/usr/local/nginx/
Total 16
Drwxr-xr-x 2 root 4096 Jun 24 conf
Drwxr-xr-x 2 root 4096 Jun 24 14:42 html
Drwxr-xr-x 2 root 4096 Jun 24 logs
Drwxr-xr-x 2 root 4096 Jun 24 sbin
2. Modify the listening port in the configuration file to prevent other programs from occupying the port.
Modify the configuration file:/usr/local/nginx/conf/nginx. conf
Modify port: 80> 9090
2.1 set the Linux Firewall and open port 9090
Run the following command:
#/Sbin/iptables-I INPUT-p tcp -- dport 9090-j ACCEPT
Save setting command:
#/Etc/rc. d/init. d/iptables save
Command to view port opening:
#/Etc/init. d/iptables status
Restart the Firewall Service
#/Etc/rc. d/init. d/iptables restart
3. Start and Stop Nginx
A. Start the command
#/Usr/local/nginx/sbin/nginx
B. Stop command
#/Usr/local/nginx/sbin/nginx-s stop
C. Check the configuration file
#/Usr/local/nginx/sbin/nginx-t-c/usr/local/nginx/conf/nginx. conf
D. Check the nginx version and the complete version.
#/Usr/local/nginx/sbin/nginx-V
Nginx version: nginx/1.6.0
#/Usr/local/nginx/sbin/nginx-V
Nginx version: nginx/1.6.0
Built by gcc 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
Configure arguments: -- prefix =/usr/local/nginx -- with-openssl =/usr/local/openssl -- with-http_stub_status_module
Build an LVS load balancing test environment
Introduction to practical Server Load balancer Technology website performance optimization
Deployment of Nginx + MySQL + PHP in CentOS 6.2
Build a WEB server using Nginx
Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Performance Tuning for Nginx in CentOS 6.3
Configure Nginx to load the ngx_pagespeed module in CentOS 6.3
Install and configure Nginx + Pcre + php-fpm in CentOS 6.4
Nginx installation and configuration instructions
Nginx details: click here
Nginx: click here
This article permanently updates the link address: