Nginx source code compilation and installation
Installation environment centos6.5
1. Installation must be in the environment
The compilation of nginx requires cantilever, while prce (redirection support) and openssl (https support) also need to be installed.
[root@admin ~] # yum install gcc-c++
[root@admin ~] # yum-y install pcre*
[root@admin ~] # yum-y install openssl*
two。 Download nginx-1.9.9.tar.gz and put it in the / usr/local/ directory
[root@admin ~] # cd / usr/local/
[root@admin local] # wget http://nginx.org/download/nginx-1.9.9.tar.gz
3. Create Nginx user groups and users
Groupadd nginx
Useradd-s / sbin/nologin-M-g nginx nginx
4. Compilation and installation
Cd nginx-1.9.9
. / configure-user=nginx-group=nginx
If you do not have error information, you can perform the following installation:
Makemake install
5. Open the firewall port 80
/ sbin/iptables-I INPUT-p tcp-- dport 80-j ACCEPT # Open port 80
/ etc/rc.d/init.d/iptables save # Save configuration
/ etc/rc.d/init.d/iptables restart # restart the service
6. Start the nginx service
Enter the installation directory / usr/local/nginx
[root@admin ~] # cd / usr/local/nginx
[root@admin sbin] #. / nginx
7. You can visit the ip:80 test, and the prompt on the page indicates that the installation is successful.