1、官方自行下載nginx源碼
2、切換到解壓后的nginx目錄中執(zhí)行:
./configure --prefix=/opt/demo/nginx --add-module=/home/fastdfs-nginx-module/src??--with-http_stub_status_module --with-http_ssl_module
參數(shù)說明:
--prefix 用于指定nginx編譯后的安裝目錄
--add-module 為添加的第三方模塊,此次添加了fdfs的nginx模塊
--with..._module 表示啟用的nginx模塊,如此處啟用了http_ssl_module模塊
根據(jù)需要來自行選擇,如下是我的執(zhí)行腳本
./configure --prefix=/home/songxiaohu/nginx-1.16.0/nginx ? --with-http_stub_status_module --with-http_ssl_module
3、
可能出現(xiàn)的錯(cuò)誤:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?出現(xiàn)./configure: error: C compiler cc is not found
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?解決辦法:yum -y install gcc gcc-c++ autoconf automake make
出現(xiàn):./configure: ?error:?the?HTTP?rewrite?module?requires?the?PCRE?library.
解決方法:yum?-y?install?pcre-devel
出現(xiàn):SSL modules require the OpenSSL library
解決方法:yum?install?openssl-devel?
4、執(zhí)行
? ? ? ? ?./configure --prefix=/home/songxiaohu/nginx-1.16.0/nginx ? --with-http_stub_status_module --with-http_ssl_module
5、編譯
? ? ? ?執(zhí)行make?進(jìn)行編譯,如果編譯成功的話會(huì)在第一步中objs中出現(xiàn)一個(gè)nginx文件
6、安裝
執(zhí)行make install 進(jìn)行安裝,安裝后--prefix 中指定的安裝目錄下(此處為:/home/songxiaohu/nginx-1.16.0/nginx)存在相關(guān)的文件
7、啟動(dòng)nginx
nginx的一些常用管理命令
? ? ? ? ? ? ? ? ? ? ?啟動(dòng):nginx –c ../conf/nginx.conf
重啟:nginx -s reload
停止:nginx -s stop或者是通過kill nginx進(jìn)程號(hào)
查看版本:nginx –V
?














