Compile and install nginx under Linux

Step 1: If the c++ compilation environment is not installed, you have to install it. Check the following:

>rpm -qa | grep gcc

If none of these three appear or one less. Need to install g++, gcc, the installation is as follows:

>yum install gcc-c++

Step 2: Install pcre-devel

>yum -y install pcre-devel

Step 3: Install openssl and openssl-devel

>yum -y install openssl openssl-devel

Step 4: Download the corresponding version from http://nginx.org/download/, or directly download the following command on Linux:

>wget http://nginx.org/download/nginx-1.5.9.tar.gz)

Step 5: Unzip tar -zxvfnginx-1.5.9.tar.gz, enter the nginx-1.5.9 directory to compile and install

Step 6: Set the installation location or do not perform this step, directly the default path, set the command:

>./configure --prefix=/usr/local/nginx     [operate in the nginx-1.5.9 directory]

Step 7: Compile and Install

>make & make install    [operate in the nginx-1.5.9 directory]

Step 8: Modify the config file information

> vi /usr/local/nginx/config/nginx.conf

Check whether the installation is successful command and verify the successful installation result display

Step 9: Start nginx

> cd /usr/local/nginx/sbin

> ./nginx

Check if the startup is successful

> ps -ef | grep nginx

Step 10: Firewall development port 80

> vi /etc/sysconfig/iptables

添加:-A INPUT -m state --state NEW -m tcp -p tcp --dport 80-j ACCEPT

Restart the firewall: > service iptables restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324651833&siteId=291194637