开心六月综合激情婷婷|欧美精品成人动漫二区|国产中文字幕综合色|亚洲人在线成视频

    1. 
      
        <b id="zqfy3"><legend id="zqfy3"><fieldset id="zqfy3"></fieldset></legend></b>
          <ul id="zqfy3"></ul>
          <blockquote id="zqfy3"><strong id="zqfy3"><dfn id="zqfy3"></dfn></strong></blockquote>
          <blockquote id="zqfy3"><legend id="zqfy3"></legend></blockquote>
          打開(kāi)APP
          userphoto
          未登錄

          開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

          開(kāi)通VIP
          CentOS 7 安裝Nginx 并配置自動(dòng)啟動(dòng)

          1、官網(wǎng)下載安裝包

              http://nginx.org/en/download.html,選擇適合Linux的版本,這里選擇最新的版本,下載到本地后上傳到服務(wù)器或者centos下直接wget命令下載。

              切換到/usr/local目錄,下載軟件包

          1
          2
          # cd /usr/local
          # wget http://nginx.org/download/nginx-1.11.5.tar.gz

          2、安裝nginx

          先執(zhí)行以下命令,安裝nginx依賴庫(kù),如果缺少依賴庫(kù),可能會(huì)安裝失敗,具體可以參考文章后面的錯(cuò)誤提示信息。

          1
          2
          3
          4
          5
          6
          7
          # yum install gcc-c++
          # yum install pcre
          # yum install pcre-devel
          # yum install zlib 
          # yum install zlib-devel
          # yum install openssl
          # yum install openssl-devel

              解壓安裝包

          1
          # tar -zxvf nginx-1.11.5.tar.gz

              nginx被解壓到了/usr/local/nginx-1.11.5 目錄下(不要把壓縮包解壓到/usr/local/nginx目錄下,或者將解壓后的目錄重命名為nginx,因?yàn)閚ginx會(huì)默認(rèn)安裝到/usr/local/nginx目錄下),切換到nginx-1.11.5/目錄

          1
          # cd /usr/local/nginx-1.11.5/

              執(zhí)行# ./configure

          1
          # ./configure

              該操作會(huì)檢測(cè)當(dāng)前系統(tǒng)環(huán)境,以確保能成功安裝nginx,執(zhí)行該操作后可能會(huì)出現(xiàn)以下幾種提示:

              checking for OS

               + Linux 3.10.0-123.el7.x86_64 x86_64

              checking for C compiler ... not found

              ./configure: error: C compiler cc is not found

              如果出現(xiàn)以上錯(cuò)誤提示信息,執(zhí)行yum install gcc-c++安裝gcc,

              ./configure: error: the HTTP rewrite module requires the PCRE library.

              You can either disable the module by using --without-http_rewrite_module

              option, or install the PCRE library into the system, or build the PCRE library

              statically from the source with nginx by using --with-pcre=<path> option.

              如果出現(xiàn)上面提示,表示缺少PCRE庫(kù)

              ./configure: error: the HTTP gzip module requires the zlib library.

              You can either disable the module by using --without-http_gzip_module

              option, or install the zlib library into the system, or build the zlib library

              statically from the source with nginx by using --with-zlib=<path> option.

              如果出現(xiàn)以上提示,表示缺少zlib庫(kù)


              如果沒(méi)有出現(xiàn)./configure: error提示,表示當(dāng)前環(huán)境可以安裝nginx,執(zhí)行make和make install編譯nginx

          1
          2
          # make
          # make install

              沒(méi)有出錯(cuò)的話,表示nginx已經(jīng)成功安裝完成,默認(rèn)安裝位置為/usr/local/nginx,之前的/usr/local/nginx-1.11.5/可以刪除掉了。

              如果出現(xiàn)cp: 'conf/koi-win' and '/usr/local/nginx/conf/koi-win' are the same file,可能是你把安裝包解壓到了/usr/local/nginx目錄,解決辦法是將該目錄重命名為其他名稱后再執(zhí)行make,make install.

          3、配置nginx開(kāi)機(jī)啟動(dòng)

              切換到/lib/systemd/system/目錄,創(chuàng)建nginx.service文件vim nginx.service

          1
          2
          # cd /lib/systemd/system/
          # vim nginx.service

          文件內(nèi)容如下:

          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          [Unit]
          Description=nginx 
          After=network.target 
             
          [Service] 
          Type=forking 
          ExecStart=/usr/local/nginx/sbin/nginx
          ExecReload=/usr/local/nginx/sbin/nginx reload
          ExecStop=/usr/local/nginx/sbin/nginx quit
          PrivateTmp=true 
             
          [Install] 
          WantedBy=multi-user.target

              退出并保存文件,執(zhí)行systemctl enable nginx.service使nginx開(kāi)機(jī)啟動(dòng)

          1
          # systemctl enable nginx.service

          systemctl start nginx.service    啟動(dòng)nginx

          systemctl stop nginx.service    結(jié)束nginx

          systemctl restart nginx.service    重啟nginx

          4、驗(yàn)證是否安裝成功

              輸入http://服務(wù)器IP/ 如果能看到nginx的界面,就表示安裝成功了

          本文轉(zhuǎn)載于挨踢農(nóng)民工:http://www.zhaoweihua.cn/article/30/nginx1.11-centos7.html

          本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
          打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
          猜你喜歡
          類似文章
          CentOS7.0安裝Nginx 1.7.4
          Centos7安裝Nginx實(shí)戰(zhàn)
          Centos 通過(guò) Nginx 和 vsftpd 構(gòu)建圖片服務(wù)器
          nginx下載安裝
          centOS7安裝nginx及nginx配置
          centos7安裝nginx
          更多類似文章 >>
          生活服務(wù)
          分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
          綁定賬號(hào)成功
          后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
          如果VIP功能使用有故障,
          可點(diǎn)擊這里聯(lián)系客服!

          聯(lián)系客服