Centos 7 nginx-1.12.0編譯安裝,centosnginx-1.12.0

來源:互聯網
上載者:User

Centos 7 nginx-1.12.0編譯安裝,centosnginx-1.12.0
參考:http://www.nginx.cn/install也不知道我的系統是否有這些依賴包,試試吧?缺少哪些我就裝哪些吧,多踏點坑總是能學到點東西的. 擷取nginx包http://nginx.org/en/download.htmlconfigure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid 報錯./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option  擷取pcre包ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/安裝pcrecd /usr/local/srcwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gztar -zxvf pcre-8.37.tar.gzcd pcre-8.34./configure --prefix=/usr/local/pcremakemake install 報錯configure: error: You need a C++ compiler for C++ support.  安裝gccyum install gcc gcc-c++再次安裝pcre,成功安裝pcre 重新安裝nginx ./configure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid報錯./configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using --without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using --with-zlib=<path> option. 安裝zlib擷取zlib包http://zlib.net/[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure --prefix=/usr/local/zlibmake && make install 重新安裝nginx./configure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid make && make install 啟動[root@bogon nginx]# systemctl start nginxFailed to start nginx.service: Unit nginx.service failed to load: No such file or directory.說明安裝失敗 是不是沒有安裝ssl呢,我查到系統是有安裝的,不放心我就再安裝一次吧../config --prefix=/usr/local --openssldir=/usr/local/sslmake && make install./config shared --prefix=/usr/local --openssldir=/usr/local/sslmake cleanmake && make install 看來還是照著教程安裝才算靠譜刪除zlib pcre到對應目錄運行 make uninstall 安裝pcrecd /usr/local/srcwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gztar -zxvf pcre-8.37.tar.gzcd pcre-8.34./configure --prefix=/usr/local/pcremakemake install 安裝zlib擷取zlib包http://zlib.net/[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure --prefix=/usr/local/zlibmake && make install 重新安裝nginx./configure --sbin-path=/usr/local/nginx/nginx \--conf-path=/usr/local/nginx/nginx.conf \--pid-path=/usr/local/nginx/nginx.pid \--with-http_ssl_module \--with-pcre=/usr/local/src/pcre-8.40 \--with-zlib=/usr/local/src/zlib-1.2.11 \--with-openssl=/usr/local/src/openssl-1.0.2l [root@bogon nginx-1.12.0]# ./configure --sbin-path=/usr/local/nginx/nginx \> --conf-path=/usr/local/nginx/nginx.conf \> --pid-path=/usr/local/nginx/nginx.pid \local/src/openssl-1.0.2l> --with-http_ssl_module \> --with-pcre=/usr/local/src/pcre-8.40 \> --with-zlib=/usr/local/src/zlib-1.2.11 \> --with-openssl=/usr/local/src/openssl-1.0.2l  [root@bogon nginx-1.12.0]# make && make install 修改/etc/local/nginx/nginx.conf 將lisent商品80改為8080啟動服務:/etc/local/nginx/nginx 訪問:http://192.168.158.128:8080 Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org.Commercial support is available at nginx.com. Thank you for using nginx.  啟動nginx服務方法一:/usr/local/nginx/nginx方法二(-c nginx設定檔地址):/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf 停止nginx服務方法一:從容停止查看進程[root@bogon nginx]# ps -ef | grep nginxroot 62024 1 0 07:01 ? 00:00:00 nginx: master process /usr/local/nginx/nginxnobody 62025 62024 0 07:01 ? 00:00:00 nginx: worker processroot 62308 18453 0 07:14 pts/1 00:00:00 grep --color=auto nginx殺死進程[root@bogon nginx]# kill -QUIT 62024 方法二:快速停止查看進程[root@bogon nginx]# ps -ef | grep nginxroot 62358 1 0 07:17 ? 00:00:00 nginx: master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.confnobody 62359 62358 0 07:17 ? 00:00:00 nginx: worker processroot 62463 18453 0 07:20 pts/1 00:00:00 grep --color=auto nginx殺死進程[root@bogon nginx]# kill -TERM 62358或者[root@bogon nginx]# /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf[root@bogon nginx]# ps -ef | grep nginxroot 62473 1 0 07:21 ? 00:00:00 nginx: master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.confnobody 62474 62473 0 07:21 ? 00:00:00 nginx: worker processroot 62476 18453 0 07:21 pts/1 00:00:00 grep --color=auto nginx[root@bogon nginx]# kill -INT 62473 方法三:強制停止[root@bogon nginx]# pkill -9 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.