The general use of Linux system of many netizens may be directly using a key installation package for installation, the previous author also this way, but many times these one-button installation is convenient but may be in the upgrade and many other places is not very good, this article on the centos6.3 installation nginx1.2 steps.
Installation Instructions
Operating system: centos6.3
Software: nginx-1.2.6.tar.gz
Installation method: Source code Installation
Installation Location:/usr/local/nginx
Nginx:http://nginx.org/en/download.html
Preparation Tools
In installing the Nginx shirt, you need to ensure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed.
- Yum Install gcc-c++
- Yum-y install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel
Check the ningx of the system installation
- Find-name Nginx
- ./nginx
- ./nginx/sbin/nginx
- ./nginx-1.2.6/objs/nginx
Uninstall the original Nginx system
- Yum Remove Nginx
CentOS installation Nginx
Upload the installation package file to the directory, this article is uploaded to/usr/local, follow the command below.
- [Email protected] local]# cd/usr/local
- [Email protected] local]# tar-zxv-f nginx-1.2.6.tar.gz
- [Email protected] local]# RM-RF nginx-1.2.6.tar.gz
- [Email protected] local]# MV nginx-1.2.6 Nginx
- [Email protected] local]# Cd/usr/local/nginx
- [Email protected] nginx]#/configure --prefix=/usr/local/nginx
- [[email protected] nginx]# make
- [[email protected] nginx]# make install
Configuring firewalls
Configure the firewall to open 80 port, do not open, sometimes the firewall will not let the extranet access to 80 port we will not be able to access the Nginx configuration site.
- #修改防火墙配置:
- [Email protected] nginx-1.2.6]# VI +/etc/sysconfig/iptables
- #添加配置项
- -A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
- #重启防火墙
- [Email protected] nginx-1.2.6]# service iptables restart
Enable Nginx command
- #方法1
- [Email protected] nginx-1.2.6]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
- #方法2
- [Email protected] nginx-1.2.6]# Cd/usr/local/nginx/sbin
- [Email protected] sbin]#./nginx
Stop Nginx Command
- #查询nginx主进程号
- Ps-ef | grep nginx
- #停止进程
- Kill-quit Main process Number
- #快速停止
- Kill-term Main process Number
- #强制停止
- Pkill-9 Nginx
Restart Nginx command
- [Email protected] local]#/usr/local/nginx/sbin/nginx-s Reload
centos6.3 Installing Nginx