Home > Backend Development > PHP Tutorial > centos67 source code compilation and installation nginx

centos67 source code compilation and installation nginx

WBOY
Release: 2016-07-30 13:31:41
Original
918 people have browsed it

Due to various problems that arose while looking for tutorials, I synthesized them myself and made my own summary, hoping to help others. Since I only posted them a few days later, I can no longer find other people’s links. Please forgive me.

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

# yum install gcc-c++

# yum -y install zlibzlib-devel openssl openssl--devel pcre pcre-devel

Check the system installed ningx

# find -name nginx

./nginx

./nt yum remove nginx

Upload the installation package file to the directory. This article uploads it to /usr/local. Follow the following commands.

[root@admin local]# cd/usr/local

[root@admin local]# tar -zxv-f nginx-1.2.6.tar.gz

[root@admin local]# rm -rfnginx- 1.2.6.tar.gz

[root@admin local]# cd/usr/local/nginx-1.2.6

[root@admin nginx-1.2.6]#mkdir -p /usr/local/nginx

[root@admin nginx-1.2.6]#./configure --prefix=/usr/local/nginx

[root@admin nginx-1.2.6]#make

[root@admin nginx-1.2.6 ]#make install

Configure the firewall to open port 80. If not, sometimes the firewall will prevent the external network from accessing port 80 and we will not be able to access the website configured by nginx.

#Modify firewall configuration:

[root@admin nginx-1.2.6]# vi+ /etc/sysconfig/iptables

#Add configuration items

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

(

ps:

The modified statement needs to be added on the line after

-A INPUT -m state --state NEW-m tcp -p tcp --dport 22 -j ACCEPT

)

#Restart firewall

[root@admin nginx-1.2.6]#service iptables restart

Enable nginx command #Method 1 [root@admin nginx-1.2.6]#/usr/local/nginx /sbin/nginx -c /usr/local/nginx/conf/nginx.conf

#Method 2

[root@admin nginx-1.2.6]# cd/usr/local/nginx/sbin

[root@admin sbin]# ./nginx

Stop nginx command

#Query nginx master Process number

ps -ef | grep nginx

#Stop process

kill -QUIT Main process number

#Quick stop

kill -TERM Main process number

#Force stop

pkill -9 nginx

Restart nginx command

[root@admin local]#/usr/local/nginx/sbin/nginx -s reload

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces centos67 source code compilation and installation of nginx, including the relevant content. 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