CentOS6.8瀹夎Nginx

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.8瀹夎Nginx相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/not' title='not'>not   tab   inf   input   alt   mit   filter   recommend   top   

涓€銆佸畨瑁呯紪璇戝伐鍏峰強搴撴枃浠?/span>

[root@centos ~]# yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

浜屻€侀鍏堣瀹夎PCRE

PCRE 浣滅敤鏄 Nginx 鏀寔 Rewrite 鍔熻兘銆?/span>

涓嬭浇銆佽В鍘嬨€佺紪璇戝畨瑁呫€佹煡鐪嬬増鏈?/span>

 [root@centos ~]# cd /usr/local/src/
 [root@centos src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.44/pcre-8.44.tar.gz
 [root@centos src]# tar -zxvf pcre-8.44.tar.gz 
 [root@centos src]# cd pcre-8.44
 [root@centos pcre-8.44]# ./configure
 [root@centos pcre-8.44]# make && make install
 [root@centos pcre-8.44]# pcre-config --version
 8.44

涓夈€佸畨瑁匩ginx

涓嬭浇銆佽В鍘嬨€佺紪璇戝畨瑁呫€佹煡鐪嬬増鏈€佸惎鍔ㄣ€佽闂?/span>

 [root@centos src]# cd /usr/local/src/
 [root@centos src]# wget http://nginx.org/download/nginx-1.14.2.tar.gz
 [root@centos src]# tar -zxvf nginx-1.14.2.tar.gz
 [root@centos src]# cd nginx-1.14.2
 [root@centos nginx-1.14.2]# ./configure --with-pcre=/usr/local/src/pcre-8.44
 [root@centos nginx-1.14.2]# make && make install
 [root@centos nginx-1.14.2]# cd /usr/local/nginx
 [root@centos nginx]# ./sbin/nginx -v
 nginx version: nginx/1.14.2
 [root@centos nginx]# ./sbin/nginx
 [root@centos nginx]# ps -ef|grep nginx
 root       2291      1  0 17:04 ?        00:00:00 nginx: master process ./sbin/nginx
 nobody     2292   2291  0 17:04 ?        00:00:00 nginx: worker process
 root       2294   2266  0 17:04 pts/0    00:00:00 grep nginx

姝ゆ椂锛岃緭鍏p:绔彛鍙互璁块棶锛岃闂箣鍓嶈閰嶇疆闃茬伀澧欙紝寮€鍙?0绔彛

 [root@centos nginx]# 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 80 -j ACCEPT
 -A INPUT -j REJECT --reject-with icmp-host-prohibited
 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
 COMMIT
 [root@centos sbin]# service iptables restart

 鎶€鏈浘鐗? src=鎶€鏈浘鐗? src=

鍙傝€冩枃妗o細https://www.runoob.com/linux/nginx-install-setup.html

以上是关于CentOS6.8瀹夎Nginx的主要内容,如果未能解决你的问题,请参考以下文章

nginx瀹夎鏁欑▼

nginx瀹夎

Nginx锛欳entOS7瀹夎Nginx

centos6.8 安装nginx

nginx安装及其配置(Centos6.8)

Centos6.8 安装nginx