Nginx is a high-performance HTTP and reverse proxy server and a IMAP/POP3/SMTP proxy server. The concurrency capabilities of Nginx do perform well in the same type of Web server. Nginx is available in some Linux distributions and in various variants of the BSD version of the installation package, and can be installed with the package management method that comes with each system.
Installation Instructions
System Environment: CentOS-6.3
Software: nginx-1.2.6.tar.gz
Installation Method: source code compilation installation
Installation Location:/usr/local/nginx
Download Address: http://nginx.org/en/download.html
Installation Prerequisites
Before installing Nginx, you need to make sure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed. Installation must be software:
[Root@admin/] #yum install gcc-c++
Yum-y install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel
Check the nginx of the system installation:
[Root@admin local]# find-name Nginx
./nginx
./nginx/sbin/nginx
./nginx-1.2.6/objs/nginx
Uninstall the original Nginx
[Root@admin/]# Yum Remove Nginx
Installation
Upload the installation package file to/usr/local to perform the following actions:
[Root@admin local]# cd/usr/local
[Root@admin local]# tar-zxv-f nginx-1.2.6.tar.gz
[Root@admin local]# RM-RF nginx-1.2.6.tar.gz
[Root@admin local]# MV nginx-1.2.6 nginx
[Root@admin local]# Cd/usr/local/nginx
[Root@admin nginx]#./configure--prefix=/usr/local/nginx
[Root@admin nginx]# make
[Root@admin nginx]# make install
Configuration
#修改防火墙配置:
[Root@admin nginx-1.2.6]# VI +/etc/sysconfig/iptables
#添加配置项
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
#重启防火墙
[Root@admin nginx-1.2.6]# Service iptables restart
Start
#方法1
[Root@admin nginx-1.2.6]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
#方法2
[Root@admin nginx-1.2.6]# Cd/usr/local/nginx/sbin
[Root@admin sbin]#./nginx
Stop it
#查询nginx主进程号
Ps-ef | grep nginx
#停止进程
Kill-quit Main process Number
#快速停止
Kill-term Main process Number
#强制停止
Pkill-9 Nginx
Reboot
[Root@admin local]#/usr/local/nginx/sbin/nginx-s Reload
Test
#测试端口
Netstat–na|grep 80
#浏览器中测试
Http://ip:80
Configuration Nginx can also be installed on Windows systems.