Centos7 在線源碼安裝Nginx

  1. 使用wget命令 下載nginx 1.9.5 源碼    下載到/usr/nginx 目錄下nginx

     wget  -nd -p --directory-prefix=/usr/nginx http://nginx.org/download/nginx-1.9.5.tar.gz服務器

  2. 解壓源碼    到/usr/nginx 目錄ui

    tar -zxvf   /usr/nginx/nginx-1.9.5.tar.gz -C   /usr/nginxspa

  3. 編譯源碼orm

    cd /usr/nginx/nginx-1.9.5 ip

    輸入   ./configure --prefix=/usr/nginx/nginx   安裝到/usr/nginx/nginx  目錄
    get

    可能報一下錯誤源碼

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

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

    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.

    http模塊 rewrite 缺乏PCRE 依賴庫 

    出現如下錯誤

                   ./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

      gzip 壓縮模塊  缺乏 zlib 依賴庫  

   清除 編譯安裝過程當中臨時文件   

        make clean   清除上次的make命令所產生的object文件(後綴爲「.o」的文件)及可執行文件。 

       make distclean  相似make clean,但同時也將configure生成的文件所有刪除掉,包括Makefile文件

4.進入   sbin 目錄 啓動nginx  

    ./nginx

   注意:服務器防火牆必須放開 80端口  

相關文章
相關標籤/搜索