编译nginx源码包
生活随笔
收集整理的這篇文章主要介紹了
编译nginx源码包
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
源碼包指的是開發編寫好的程序源代碼,但并沒有將其編譯為一個能正常使用的二進制工具,部分軟件官網僅提供源碼包,需要自行編譯并安裝,下面以nginx1.21.1版本為例;
1.下載源碼包
在官網https://nginx.org/en/download.html找到源碼包,復制鏈接地址下載:
[root@localhost data]# wget https://nginx.org/download/nginx-1.21.1.tar.gz2.解壓源碼包,并進入目錄
[root@localhost data]# tar xf nginx-1.21.1.tar.gz [root@localhost data]# cd nginx-1.21.13.基礎環境準備,先安裝一些需要的環境
3.基礎環境準備[root@localhost ~]# yum install -y gcc make4.配置相關選項,生成makefile,中間會出現錯誤,需要安裝相關軟件包
[root@localhost nginx-1.21.1]# ./configure --prefix=/usr/local/nginx-1.21.1 --with-http_ssl_module --with-http_stub_status_module ./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. [root@localhost nginx-1.21.1]# yum install -y pcre-devel zlib-devel ./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option. [root@localhost nginx-1.21.1]# yum install openssl openssl-devel -y [root@localhost nginx-1.21.1]# ./configure --prefix=/usr/local/nginx-1.21.1 --with-http_ssl_module --with-http_stub_status_module?5.編譯并把相關文件釋放到目錄
[root@localhost nginx-1.21.1]# make && make install6.創建軟鏈接
[root@localhost nginx-1.21.1]# ln -s /usr/local/nginx-1.21.1/ /usr/local/nginx7.啟動nginx
[root@localhost nginx-1.21.1]# /usr/local/nginx/sbin/nginx8.從瀏覽器訪問虛擬機地址10.0.0.100顯示?,配置成功
?
總結
以上是生活随笔為你收集整理的编译nginx源码包的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MATLAB灰度显示和彩色显示
- 下一篇: 一个牛人给Java小生们的建议