日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nginx源码部署

發(fā)布時間:2023/12/14 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx源码部署 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

nginx 需要安裝的依賴

#centos 安裝 yum -y install gcc pcre-devel zlib-devel openssl openssl-devel #ubuntu apt-get install gcc pcre-devel zlib-devel openssl openssl-devel #未進行測試 mac : brew install gcc brew install openssl

nginx 源碼安裝

#如果沒有安裝wget 請安裝后使用 mac: brew install wget centos: yum install wget ubuntu: apt-get install wget # 使用wget下載穩(wěn)定版 Nginx wget https://nginx.org/download/nginx-1.22.0.tar.gz

解壓縮

tar -zxvf nginx-1.22.0.tar.gz

安裝

cd nginx-1.22.0 #執(zhí)行 ./configure --prefix=/usr/local/nginx --with-openssl=/root/openssl-1.1.1g

如果缺少依賴會出現(xiàn)報錯

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

解決error: the HTTP rewrite module requires the PCRE library

#下載最新版本pcre地址:http://www.pcre.org. #解壓到 /usr/local/src tar -zxvf pcre-8.45.tar.gz sudo mkdir -p /usr/local/src sudo chmod -R 777 /usr/local/src mv ~/Downloads/pcre-8.45 /usr/local/src/pcre cd pcre ./configure --prefix=/usr/local sudo chmod -R 777 /usr/local/lib sudo chmod -R 777 /usr/local/share sudo chmod -R 777 /usr/local/bin sudo make && make install #沒有報錯即解決pcre依賴問題

編譯并安裝nginx

sudo make && make install""" error: mkdir: /usr/local/nginx: Permission denied make[1]: *** [install] Error 1 make: *** [install] Error 2 """ sudo mkdir -p /usr/local/nginx sudo chmod -R 777 /usr/local/nginx sudo make && make install cd /usr/local/nginx/sbin ./nginx 輸入地址 http://localhost:80看到如圖內(nèi)容,即nginx部署成功補充說明:每次啟動會麻煩可以建立全局變量 方案一:ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/ 方案二:vi /etc/profileexport NGINX_HOME=/usr/local/nginxexport PATH=$PATH:$NGINX_HOME/sbinsource /etc/profile 配置后啟動: nginx

總結(jié)

以上是生活随笔為你收集整理的nginx源码部署的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。