: This article mainly introduces how to compile and install nginx from centos67 source code. if you are interested in the PHP Tutorial, refer to it. Due to various problems occurred during the course of searching for the tutorial, I made a summary and hoped to help others. it was only a few days after the event, no other person's link is found. Sorry.
Before installing nginx, make sure that the system has installed g ++, gcc, openssl-devel, pcre-devel, and zlib-devel.
# Yum install gcc-c ++
# Yum-y install zlibzlib-devel openssl -- devel pcre-devel
Check ningx installed in the system
# Find-name nginx
./Nginx
./Nginx/sbin/nginx
./Nginx-1.2.6/objs/nginx
(PS: Yellow indicates the content to be searched)
If yes, uninstall the original nginx
# Yum remove nginx
Upload the installation package file to the directory. in this document, upload the file to/usr/local. run the following command to perform operations.
[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 enable port 80. if port 80 is not enabled, sometimes the firewall will not allow the internet to access port 80 and we will not be able to access the website configured for nginx.
# Modify the 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: add the modified statement to the next line after-a input-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT)
# Restarting the firewall
[Root @ admin nginx-1.2.6] # service iptables restart
Enable nginx commands
# 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 commands
# Querying the nginx master process number
Ps-ef | grep nginx
# Stop a process
Kill-QUIT master process number
# Quick Stop
Kill-TERM Master process number
# Force stop
Pkill-9 nginx
Restart nginx command
[Root @ admin local] #/usr/local/nginx/sbin/nginx-s reload
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes how to compile and install nginx from the centos67 source code, including some content. I hope to help some friends who are interested in PHP tutorials.