Home > Backend Development > PHP Tutorial > Installing Nginx on CentOS6.5 system on Alibaba Cloud

Installing Nginx on CentOS6.5 system on Alibaba Cloud

WBOY
Release: 2016-08-08 09:32:00
Original
1115 people have browsed it

1. Installation in the form of a package

Installation instructions

System environment: CentOS-6.5

Software: nginx-1.6.2.tar.gz
Installation method: Source code compilation and installation
Installation location: /opt/program/nginx-1.6.2
Download address: http://nginx.org/en/download.html

Installation prerequisites

Before installing nginx, you need to ensure that the system has g++, gcc, openssl-devel, pcre-devel and zlib-devel software. Install necessary software:

# yum install gcc-c++
# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
# find -name nginx
. /nginx
./nginx/sbin/nginx
./nginx-1.2.6/objs/nginx

Check the Nginx installed on the system:

Uninstall the original Nginx

# yum remove nginx

Installation

Upload the installation package file to /opt/software and perform the following operations:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT#Restart the firewall # service iptables restart
# cd /opt/program
# mkdir nginx
# tar -zxvf ../software/nginx -1.6.2.tar.gz
# cd nginx-1.6.2
# ./configure --prefix=/opt/program/nginx Note: This is the installation directory for specifying nginx. Most users are accustomed to installing it in /usr Under /local/nginx
# make                                                                                         using                           using   using   using             use using          ‐  through off  under  ‐  ‐ ‐                                                                                                                         /iptables
#Add configuration item

Start# /opt/program/nginx/sbin/nginx -c /opt/program/nginx/sbin/nginx/conf/nginx.conf#Method 2# /opt/program/nginx/ sbin/nginx



#Method 1

Stopps -ef | grep nginx#Stop the process kill -QUIT main process number



#Query nginx main process number

#Quickly stop

kill -TER M Main process number #Force stop

pkill -9 nginx


Restart






#
/opt/program/nginx/sbin/nginx

-s reload

Test

netstat –na|grep 80#Test in browser http://ip:80

#Test port

2. Install using yum

1. Install directly through yum

# yum list | grep nginx

# yum -y install nginx

2. Download the rpm package and install php, nginx

# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6. ngx.noarch.rpm

# yum -y install nginx

# yum -y php-fpm

# service php-fpm restart

# service nginx re start

# chkconfig php-fpm on Set to start automatically at boot

# chkconfig nginx on Set to start automatically at boot

# netstat -lntp | grep nginx View port

Reference URL:

http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html

The above introduces the installation of Nginx on CentOS6.5 system on Alibaba Cloud, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template