Installation Environment :Centos 6.4 32-bit nginx1.6.3
One, install Prce (redirect support) and OpenSSL (HTTPS support)
[[email protected] ~]$ sudo yum install -y pcre pcer-devel[[email protected] ~]$ sudo yum install -y Openssl openssl-devel
Span style= "font-family: ' Microsoft Jas Black ', ' Microsoft Yahei ';" > Two, download unzip nginx1.6.3
[Email protected] ~]$ wget [[email protected] ~]$ tar zxf nginx-1.6.3.tar.gz
Third, compile and install Nginx
[[email protected] ~]$ cd nginx-1.6.3[[email protected] nginx-1.6.3]$ lltotal 624drwxr-xr-x. 6 ptt003 ptt003 4096 nov 20 23:57 auto-rw-r--r--. 1 ptt003 ptt003 236608 Apr 7 2015 Changes-rw-r--r--. 1 ptt003 ptt003 360501 Apr 7 2015 changes.rudrwxr-xr-x. 2 ptt003 ptt003 4096 nov 20 23:57 conf-rwxr-xr-x. 1 ptt003 ptt003 2369 apr 7 2015 configuredrwxr-xr-x. 4 ptt003 ptt003 4096 nov 20 23:57 contribdrwxr-xr-x. 2 ptt003 ptt003 4096 nov 20 23:57 html-rw-r--r--. 1 ptt003 ptt003 1397 Apr 7 2015 licensedrwxr-xr-x. 2 p tt003 ptt003 4096 nov 20 23:57 man-rw-r--r--. 1 ptt003 ptt003 49 apr 7 2015 readmedrwxr-xr-x.  8 PTT003 PTT003   4096 NOV 20 23:57 SRC Create an nginx user [[Email protected] nginx-1.6.3]$ sudo useradd -s /sbin/nologin -M Nginx Compiler Installation nginx[[email protected] nginx-1.6.3]$ sudo ./configure --user=nginx -- group=nginx --prefix=/home/ptt003/nginx --with-http_stub_status_module --with-http_ssl_module[[ email protected] nginx-1.6.3]$ echo $?0 if not 0, find and resolve the error after retrying [[email protected] nginx-1.6.3]$ sudo make[[email protected] nginx-1.6.3]$ echo $?0[[email protected] nginx-1.6.3]$ sudo make install[[email protected] nginx-1.6.3]$ Echo $?0
Four, start Nginx
[[email protected] nginx-1.6.3]$ cd .. /nginx[[email protected] nginx]$ lltotal 16drwxr-xr-x. 2 root root 4096 nov 21 00:23 confdrwxr-xr-x. 2 root root 4096 nov 21 00:23 htmldrwxr-xr-x. 2 root root 4096 Nov 21 00:23 logsdrwxr-xr-x. 2 root root 4096 nov 21 00:23 sbin[[email protected] nginx]$ sudo sbin/nginx -tnginx: the configuration file / home/ptt003/nginx/conf/nginx.conf syntax is oknginx: configuration file /home/ Ptt003/nginx/conf/nginx.conf test is successful[[email protected] nginx]$ sudo sbin/nginx to see if Nginx started successfully [[email protected] nginx]$ ps aux|grep nginxroot 7691 0.0 0.0 7536 796 ? ss 00:26 0:00 nginx: master process sbin/nginxnginx 7692 0.0 0.1 7704 1160 ? s 00:26 0:00 nginx: worker processptt003 7709 0.0 0.0 4356 736 pts Restart of/2 s+ 00:27 0:00 grep nginxnginx [email protected] nginx]$ sudo sbin/nginx -s reload
[[email protected] nginx]$ sudo vim /etc/sysconfig/iptables# firewall configuration written by system-config-firewall# manual customization of This file is not recommended.*filter:input accept [0:0]:forward accept [0:0]:output accept [0:0]-a input -m state --state established, Related -j accept-a input -p icmp -j accept-a input -i lo -j accept-a input -m state --state new -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m Tcp -p tcp --dport 3690 -j accept-a input -m state --state new -m tcp -p tcp --dport 8090 -j accept-a input -m state --state NEW -m tcp -p tcp --dport 80 -j accept-a input -j reject -- reject-with icmp-host-prohibited-a forward -j reject --reject-with icmp-host-prohibitedcommit:wq[[email protected] nginx]$ sudo /etc/init.d/iptables Restart[[email protected] nginx]$ sudo sbin/nginx -s reload
Open the browser access server IP, the following content is successful
Welcome to nginx!
Vi. Modify Nginx configuration file so that the domain name can be accessed
[[email protected] nginx]$ sudo vim conf/nginx.conf
This article is from the "Margin Fly" blog, please be sure to keep this source http://yuanfei.blog.51cto.com/9953199/1714882
CentOS installation Nginx