CentOS 7 安裝nginx-1.9.12

來源:互聯網
上載者:User

標籤:linux   nginx   centos7   

CentOS 7 安裝nginx-1.9.12


一、安裝環境:CentOS 7  Linux version 3.10.0-229.el7.x86_64

              Nginx-1.9.12

二、安裝步驟

2.1 關閉防火牆

因為Centos 7的防火牆預設是開啟的,所以先關閉防火牆,並禁止開機啟動

命令:systemctl stop firewalld.service #關閉防火牆

      systemctl disable firewalld.service #禁止開機啟動

相關如下

650) this.width=650;" title="1-firewall" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="1-firewall" src="http://s3.51cto.com/wyfs02/M01/7F/82/wKioL1chdQniHs_lAAAaFDRY91w577.jpg" height="43" />

2.2 安裝pcre 與openssl

命令1:yum install pcre*

650) this.width=650;" title="2-pcre" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="2-pcre" src="http://s3.51cto.com/wyfs02/M02/7F/82/wKioL1chdQqxybM6AAANrpevRas118.jpg" height="41" />

所示結果,表示安裝完成。

650) this.width=650;" title="3-pcre" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="3-pcre" src="http://s3.51cto.com/wyfs02/M00/7F/82/wKioL1chdQzAAYB1AAAlh7idjWY641.jpg" height="137" />

命令2:yum install openssl*

650) this.width=650;" title="4-openssl" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="4-openssl" src="http://s3.51cto.com/wyfs02/M00/7F/84/wKiom1chdELBp-qkAAA1d3oalE4987.jpg" height="134" />

所示結果,表示安裝完成。

650) this.width=650;" title="5-openssl" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="5-openssl" src="http://s3.51cto.com/wyfs02/M00/7F/82/wKioL1chdQ_TTxMGAAAhw86CboM446.jpg" height="87" />

2.3 下載nginx-1.9.12

命令:wget http://nginx.org/download/nginx-1.9.12.tar.gz

650) this.width=650;" title="2016-04-10 23-50-24" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="2016-04-10 23-50-24" src="http://s3.51cto.com/wyfs02/M02/7F/84/wKiom1chdEWRunFKAAASnHuJflA527.jpg" height="52" />

2.4 解壓

命令:cd /usr/local/src

tar –zxf nginx-1.9.12.tar.gz

650) this.width=650;" title="6-tar" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="6-tar" src="http://s3.51cto.com/wyfs02/M01/7F/82/wKioL1chdRKyun-JAAAsYydaduM379.jpg" height="111" />

2.5 配置nginx

命令:cd nginx-1.9.12

./configure --prefix=/usr/local/nginx-1.9.12 --with-http_ssl_module --with-pcre

--prefix=/usr/local/nginx-1.9.12  #安裝目錄

--with-http_ssl_module #支援https

--with-pcre #支援rewrite功能

所示結果,表示安裝成功。

650) this.width=650;" title="8-configure" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="8-configure" src="http://s3.51cto.com/wyfs02/M00/7F/84/wKiom1chdEii4NfTAAAwXbyX5S8057.jpg" height="137" />

2.6 編譯

命令:make

650) this.width=650;" title="9-make" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="9-make" src="http://s3.51cto.com/wyfs02/M00/7F/82/wKioL1chdRWgiKBmAAAx4ZFPtz8475.jpg" height="152" />

2.7 安裝

命令:make install

650) this.width=650;" title="10-makeinstall" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="10-makeinstall" src="http://s3.51cto.com/wyfs02/M02/7F/82/wKioL1chdRfwZ8ihAAA3K0l_4r8688.jpg" height="133" />

2.8 啟動,關閉,重啟nginx服務

命令:/usr/local/nginx-1.9.12/sbin/nginx #啟動

      /usr/local/nginx-1.9.12/sbin/nginx –s stop #關閉

      /usr/local/nginx-1.9.12/sbin/nginx –s reload #重啟

所示結果,表示nginx服務啟動成功。

650) this.width=650;" title="11-servicestart" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="11-servicestart" src="http://s3.51cto.com/wyfs02/M01/7F/82/wKioL1chdRiR1fVdAAAXKGW94a0836.jpg" height="38" />

也可以在網頁中輸入安裝伺服器的IP地址,出現所示結果,表示服務安裝成功。

650) this.width=650;" title="12-web" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="12-web" src="http://s3.51cto.com/wyfs02/M01/7F/84/wKiom1chdE3DouM1AAAULZaWoag934.jpg" height="93" />

 

2.9 建立記錄檔,為安裝zabbix做準備

命令:

mkdir /data

mkdir /data/logs

mkdir /data/logs/nginx

本文出自 “點滴技術” 部落格,請務必保留此出處http://tryrus.blog.51cto.com/10914693/1768483

CentOS 7 安裝nginx-1.9.12

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.