人妻系列无码专区av在线,国内精品久久久久久婷婷,久草视频在线播放,精品国产线拍大陆久久尤物

當(dāng)前位置:首頁(yè) > 前端設(shè)計(jì) > 正文

nginx安裝步驟 nginx安裝及配置教程

nginx安裝步驟 nginx安裝及配置教程

各位老鐵們,大家好,今天由我來為大家分享nginx安裝步驟,以及nginx安裝及配置教程的相關(guān)問題知識(shí),希望對(duì)大家有所幫助。如果可以幫助到大家,還望關(guān)注收藏下本站,您的...

各位老鐵們,大家好,今天由我來為大家分享nginx安裝步驟,以及nginx安裝及配置教程的相關(guān)問題知識(shí),希望對(duì)大家有所幫助。如果可以幫助到大家,還望關(guān)注收藏下本站,您的支持是我們最大的動(dòng)力,謝謝大家了哈,下面我們開始吧!

如何快速安裝Nginx

下面介紹一下Centos下安裝Nginx的方法

Nginx的官網(wǎng):http://nginx.org/,Nginx有三個(gè)版本:穩(wěn)定版、開發(fā)版和歷史穩(wěn)定版。開發(fā)版更新快,包含最新的功能和bug修復(fù),但同時(shí)也可能會(huì)出現(xiàn)新的bug。開發(fā)版一旦更新穩(wěn)定下來,就會(huì)被加入穩(wěn)定版分支,穩(wěn)定版更新較慢,但bug較少,所以生產(chǎn)環(huán)境優(yōu)先選擇穩(wěn)定版。

一、下載Nginx安裝文件

目前最新穩(wěn)定版:

http://nginx.org/download/nginx-1.16.0.tar.gz

,可以先下載好安裝文件再通過ftp上傳的CentOS上,也可以在CentOS上直接通過wget命令下載,這里我將文件下載到了/home/software文件夾下,如下:

[root@localhostsoftware]#pwd/home/software[root@localhostsoftware]#wgethttp://nginx.org/download/nginx-1.10.1.tar.gz二、解壓安裝文件[root@songguoliangsoftware]#tar-xzvfnginx-1.10.1.tar.gz三、執(zhí)行configure命令

通過cd命令進(jìn)入Nginx解壓文件目錄,執(zhí)行該目錄下的configure命令,--prefix是打算將Nginx安裝在哪個(gè)目錄。在執(zhí)行configure命令之前,確保安裝了gcc、openssl-devel、pcre-devel和zlib-devel軟件庫(kù)(gzip模塊需要zlib庫(kù),rewrite模塊需要pcre庫(kù),ssl功能需要openssl庫(kù)),也可以直接執(zhí)行configure命令,根據(jù)提示缺少的軟件庫(kù)安裝,下面有缺少相應(yīng)庫(kù)報(bào)的錯(cuò)誤信息和安裝依賴庫(kù)的方法。

為了方便,我們可以先安裝一下必須的軟件庫(kù)。

[root@localhostsoftware]#yum-yinstallgccpcre-develzlib-developenssl-devel

出現(xiàn)類似下圖信息或提示之前已經(jīng)安裝過等信息,說明已經(jīng)安裝好依賴庫(kù)。如下:

這樣事先安裝好依賴庫(kù)后,就不必看下面幾個(gè)處理錯(cuò)誤的步驟了,直接進(jìn)行configure,如下:

[root@localhostsoftware]#cdnginx-1.10.1[root@localhostnginx-1.10.1]#pwd/home/software/nginx-1.10.1[root@localhostnginx-1.10.1]#./configure--prefix=/usr/local/nginx

1、如果報(bào)下面錯(cuò)誤,說明還沒有安裝gcc編譯環(huán)境,可以通過yum在線安裝功能安裝gcc,重新執(zhí)行configure命令。

[root@localhostnginx-1.10.1]#./configure--prefix=/usr/local/nginxcheckingforOS+Linux2.6.32-431.el6.x86_64x86_64checkingforCcompiler...notfound./configure:error:Ccompilerccisnotfound

在線安裝gcc:

[root@localhostnginx-1.10.1]#yuminstallgcc

2、如果報(bào)下面的錯(cuò)誤,說明沒有安裝pcre-devel庫(kù),通過yum在線安裝pcre后,重新執(zhí)行configure命令。

./configure:error:theHTTPrewritemodulerequiresthePCRElibrary.Youcaneitherdisablethemodulebyusing--without-http_rewrite_moduleoption,orinstallthePCRElibraryintothesystem,orbuildthePCRElibrarystaticallyfromthesourcewithnginxbyusing--with-pcre=<path>option.

在線安裝pcre-devel庫(kù):

[root@localhostnginx-1.10.1]#yum-yinstallpcre-devel

-y參數(shù)表示使用yum在線安裝時(shí),如果需要用戶輸入Y/N時(shí)自動(dòng)輸入Y。

3、如果報(bào)下面的錯(cuò)誤,說明沒有安裝zlib庫(kù),安裝zlib庫(kù)后重新執(zhí)行configure命令。

./configure:error:theHTTPgzipmodulerequiresthezliblibrary.Youcaneitherdisablethemodulebyusing--without-http_gzip_moduleoption,orinstallthezliblibraryintothesystem,orbuildthezliblibrarystaticallyfromthesourcewithnginxbyusing--with-zlib=<path>option.

在線安裝zlib庫(kù):

[root@localhostnginx-1.10.1]#yum-yinstallzlib-devel

4、如果報(bào)以下錯(cuò)誤,說明沒有安裝OpenSSL庫(kù),安裝OpenSSL庫(kù)后重新執(zhí)行configure命令。

./configure:error:SSLmodulesrequiretheOpenSSLlibrary.Youcaneitherdonotenablethemodules,orinstalltheOpenSSLlibraryintothesystem,orbuildtheOpenSSLlibrarystaticallyfromthesourcewithnginxbyusing--with-openssl=<path>option.

在線安裝openssl庫(kù):

[root@localhostnginx-1.10.1]#yuminstallopenssl-devel

執(zhí)行configure命令成功后,顯示如下信息:

checkingforzliblibrary...foundcreatingobjs/MakefileConfigurationsummary+usingsystemPCRElibrary+OpenSSLlibraryisnotused+usingbuiltinmd5code+sha1libraryisnotfound+usingsystemzliblibrarynginxpathprefix:"/usr/local/nginx"nginxbinaryfile:"/usr/local/nginx/sbin/nginx"nginxmodulespath:"/usr/local/nginx/modules"nginxconfigurationprefix:"/usr/local/nginx/conf"nginxconfigurationfile:"/usr/local/nginx/conf/nginx.conf"nginxpidfile:"/usr/local/nginx/logs/nginx.pid"nginxerrorlogfile:"/usr/local/nginx/logs/error.log"nginxhttpaccesslogfile:"/usr/local/nginx/logs/access.log"nginxhttpclientrequestbodytemporaryfiles:"client_body_temp"nginxhttpproxytemporaryfiles:"proxy_temp"nginxhttpfastcgitemporaryfiles:"fastcgi_temp"nginxhttpuwsgitemporaryfiles:"uwsgi_temp"nginxhttpscgitemporaryfiles:"scgi_temp"四、執(zhí)行make命令[root@localhostnginx-1.10.1]#make五、執(zhí)行makeinstall命令[root@localhostnginx-1.10.1]#makeinstall

步驟四和步驟五可以合并執(zhí)行如下命令,連接符&&代表前面一個(gè)命令如果執(zhí)行成功則繼續(xù)執(zhí)行后面的命令,如果前面命令執(zhí)行失敗則不再執(zhí)行后面的命令。而||表示如果前面的命令執(zhí)行成功則不執(zhí)行后面的命令,如果前面的命令執(zhí)行失敗則繼續(xù)執(zhí)行后面的命令

[root@localhostnginx-1.10.1]#make&&makeinstall六、啟動(dòng)Nginx服務(wù)[root@localhostnginx-1.10.1]#cd/usr/local/nginx/[root@localhostnginx]#ll總用量16drwxr-xr-x.2rootroot409610月123:35confdrwxr-xr-x.2rootroot409610月123:35htmldrwxr-xr-x.2rootroot409610月123:35logsdrwxr-xr-x.2rootroot409610月123:35sbin[root@songguoliangnginx]#./sbin/nginx

通過瀏覽器訪問Nginx,顯示如下welcometonginx!頁(yè)面便表示安裝成功:

nginx啟動(dòng)、重啟、重新加載配置文件和平滑升級(jí)

nginx啟動(dòng)、重啟、重新加載配置文件和平滑升級(jí)可以參考我博客

https://blog.csdn.net/gnail_oug/article/details/52754491

以上回答希望能對(duì)你有幫助

安裝nginx怎么看是否支持https

環(huán)境都支持HTTPS的,只是沒有SSL,需要淘寶Gworg獲取SSL證書才可以。

推薦環(huán)境如下:WIN2008R2IIS7以上版本CentOS6+OpenSSL1.0.1c+Apache2.4+Nginx1.0.6+JDK1.7tomcat7.0.56+

CentOS8如何安裝Nginx

方式一:yum安裝

安裝:

yuminstallnginx

啟用并啟動(dòng)Nginx服務(wù):

sudosystemctlenablenginx

sudosystemctlstartnginx

sudosystemctlstopnginx

要驗(yàn)證服務(wù)是否正在運(yùn)行,檢查其狀態(tài):

sudosystemctlstatusnginx

方式二:自定義目錄安裝

1.安裝工具和庫(kù)

yum-yinstallgcc-c++pcrepcre-develzlibzlib-developensslopenssl-devel

#PCRE是一個(gè)Perl庫(kù),包括perl兼容的正則表達(dá)式庫(kù)。nginx的http模塊使用pcre來解析正則表達(dá)式

#zlib庫(kù)提供了很多種壓縮和解壓縮的方式,nginx使用zlib對(duì)http包的內(nèi)容進(jìn)行g(shù)zip

2.下載并解壓nginx

wget-chttps://nginx.org/download/nginx-1.18.0.tar.gz

tar-zxvfnginx-1.18.0.tar.gz

1.configure

1

./configure--prefix=/usr/local/nginx--with-http_stub_status_module--with-http_ssl_module--with-http_v2_module--with-http_sub_module--with-http_gzip_static_module--with-pcre

#--prefix指定安裝路徑

#--with-http_stub_status_module允許查看nginx狀態(tài)的模塊

#--with-http_ssl_module支持https的模塊

執(zhí)行成功后顯示的文件路徑:

Configurationsummary+usingsystemPCRElibrary+usingsystemOpenSSLlibrary+usingsystemzliblibrary

nginxpathprefix:"/usr/local/nginx"nginxbinaryfile:"/usr/local/nginx/sbin/nginx"nginxmodulespath:"/usr/local/nginx/modules"nginxconfigurationprefix:"/usr/local/nginx/conf"nginxconfigurationfile:"/usr/local/nginx/conf/nginx.conf"nginxpidfile:"/usr/local/nginx/logs/nginx.pid"nginxerrorlogfile:"/usr/local/nginx/logs/error.log"nginxhttpaccesslogfile:"/usr/local/nginx/logs/access.log"nginxhttpclientrequestbodytemporaryfiles:"client_body_temp"nginxhttpproxytemporaryfiles:"proxy_temp"nginxhttpfastcgitemporaryfiles:"fastcgi_temp"nginxhttpuwsgitemporaryfiles:"uwsgi_temp"nginxhttpscgitemporaryfiles:"scgi_temp"

2.編譯并安裝

make&&makeinstall

進(jìn)入到安裝nginx目錄下面的sbin啟動(dòng)命令./nginx

打開瀏覽器訪問你的IP地址,顯示此頁(yè)面說明nginx啟動(dòng)成功。

其他命令:

./nginx-squit:(溫和)此方式停止步驟是待nginx進(jìn)程處理任務(wù)完畢進(jìn)行停止。./nginx-sstop:(強(qiáng)硬)此方式相當(dāng)于先查出nginx進(jìn)程id再使用kill命令強(qiáng)制殺掉進(jìn)程。./nginx-sreload重啟nginx(不推薦此方法,推薦先停止在啟動(dòng))

好了,關(guān)于nginx安裝步驟和nginx安裝及配置教程的問題到這里結(jié)束啦,希望可以解決您的問題哈!