CentOS下安裝配置Nginx

來源:互聯網
上載者:User

標籤:

1、安裝說明
系統內容:CentOS-6.3
軟體:nginx-1.9.0.tar.gz
安裝方式:源碼編譯安裝
安裝位置:/usr/local/src/nginx_1.9.0
:http://nginx.org/en/download.html

2、安裝前提
在安裝nginx前,需要確保系統安裝了g++、gcc、openssl-devel、pcre-devel和zlib-devel軟體。安裝必須軟體:
安裝命令如下:
[root@localhost /]# yum install gcc-c++
[root@localhost /]# yum -y install zlib zlib-devel openssl openssl–devel pcre pcre-devel

檢查系統安裝的Nginx:
[root@localhost /]# find -name nginx
./usr/local/src/nginx_1.9.0/sbin/nginx

卸載原有的Nginx:
[root@localhost /]# yum remove nginx

3、安裝
將安裝包檔案上傳到 /usr/local/src/中執行以下操作:
[root@localhost /]# cd /usr/local/src
[root@localhost src]# tar -zxvf nginx-1.9.0.tar.gz
[root@localhost src]# rm -rf nginx-1.2.6.tar.gz
[root@localhost src]# cd /usr/local/src/nginx-1.9.0
[root@localhost nginx_1.9.0]# ./configure –prefix=/usr/local/nginx_1.9.0
[root@localhost nginx_1.9.0]# make && make install

4、配置
進入修改防火牆配置:
[root@localhost nginx_1.9.0]# vi /etc/sysconfig/iptables
添加配置項:
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
重啟防火牆:
[root@localhost nginx_1.9.0]# service iptables restart

5、啟動nginx
[root@localhost nginx_1.9.0]# cd /usr/local/src/nginx_1.9.0/sbin
[root@localhost sbin]# ./nginx

6、測試是否成功
瀏覽器中輸入測試地址: http://ip:80

CentOS下安裝配置Nginx

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.