Nginx配置及熱升級的詳細(xì)介紹
Nginx詳解
Nginx與Apache一樣,都是web服務(wù)器,但是Nginx比Apache多一些功能,比如Nginx可以做代理,可以做負(fù)載均衡……
1. Nginx關(guān)鍵特性
- 支持高并發(fā)
- 單機(jī)Nginx可支持十萬級別的并發(fā)連接,經(jīng)過優(yōu)化后可支持百萬級別并發(fā)
- 內(nèi)存資源消耗低
- 在同級web中,Nginx占用的內(nèi)存最少,一萬非活躍的http長連接僅消耗2.5M內(nèi)存
- 高擴(kuò)展性
- 和Apache一樣,Nginx采用模塊化設(shè)計(jì),并支持非常多豐富的第三方模塊
- 高可靠性
- Nginx采用master-worker模式,如果worker出現(xiàn)故障,master可以快速開啟一個(gè)新的worker來提供服務(wù)
2. Nginx配置
[root@ceph conf.d]# grep -Ev "^#|^$|#" /etc/nginx/nginx.conf |cat -n user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 4096; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
由于之前很詳細(xì)的寫過Apache的配置了,這里就說一下這倆服務(wù)之間的差異,nginx的配置文件每行配置結(jié)束必須以分號;結(jié)尾
Nginx也可以配置啟動(dòng)的用戶,默認(rèn)為nginx,可以修改Nginx工作進(jìn)程,默認(rèn)為auto(與CPU核心數(shù)保持一致),也可以手動(dòng)修改定義nginx的錯(cuò)誤日志
這兩個(gè)都是Apache服務(wù)里面也有的,這里就簡答說一下
2.1 event
第六行event這個(gè)是指定nginx的工作模式,默認(rèn)的,Apache也有這個(gè)模式,這個(gè)段落里面的內(nèi)容
events { worker_connections 1024; 指定單個(gè)進(jìn)程的連接數(shù) }
2.2 http
這個(gè)段落里面就是一些http的配置
2.2.1 log_format
首先就是定義日志的格式log_format,然后就是access.log這個(gè)就不細(xì)寫
2.2.2 sendfile
sendfile on;這個(gè)代表高效傳輸,也就是可以將文件直接從磁盤傳輸?shù)骄W(wǎng)絡(luò)中,而不先讀到內(nèi)存
2.2.3 tcp_nopush
tcp_nopush on 立刻回應(yīng)tcp的請求
2.2.4 tcp_nodelay
tcp_nodelay on 對于小數(shù)據(jù)包直接回應(yīng)
2.2.5 keepalive_timeout
keepalive_timeout 65,這個(gè)通過名字就可以知道,是長連接的超時(shí)時(shí)間
2.2.6 include
我跳過了types_hash_max_size,這個(gè)是hash散列表,我也不知道是干嘛的
include /etc/nginx/mime.types; 這里是載入nginx能夠識別的類型,你可以打開這個(gè)文件去看這里面都定義了什么,打開就一目了然了
2.2.7 default_type
default_type application/octet-stream; 二進(jìn)制的文件可以直接下載
2.2.8 server
server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
這里的server對應(yīng)的就是Apache的虛擬主機(jī)
listen 監(jiān)聽的端口,他這里默認(rèn)監(jiān)聽了2個(gè),一個(gè)是IPv4,另一個(gè)是IPv6
server_name:對外提供的服務(wù)名,也就是域名
root:網(wǎng)站根目錄
include: 定義虛擬主機(jī)的特性,可以將一些其他的特性卸載conf.d/下之后他會自動(dòng)加載配置
error_page 404 :這個(gè)是錯(cuò)誤頁,當(dāng)404出現(xiàn)的時(shí)候,nginx會返回網(wǎng)站根目錄下的404.html
locatioin: 這個(gè)是nginx的重頭戲,叫做路由規(guī)則,你可以將路由策略寫在這,他就會根據(jù)你的策略來處理流量,這個(gè)我們稍后細(xì)講
error_page 500當(dāng)服務(wù)發(fā)生500以上的錯(cuò)誤的時(shí)候,nginx返回網(wǎng)站根目錄下的50x.html
3. 配置Nginx虛擬主機(jī)
Nginx也支持3種虛擬主機(jī),與Apache一樣
- 基于端口的虛擬主機(jī)
- 基于IP的虛擬主機(jī)
- 基于域名的虛擬主機(jī)
3.1 基于端口
虛擬主機(jī)我們可以在conf.d下進(jìn)行配置
[root@ceph conf.d]# vim virthost.conf server { listen 81; root /web1; } server { listen 82; root /web2; } [root@ceph conf.d]# echo 81 > /web1/index.html [root@ceph conf.d]# echo 82 > /web2/index.html [root@ceph conf.d]# systemctl restart nginx [root@ceph conf.d]# curl localhost:82 82 [root@ceph conf.d]# curl localhost:81 81
基于端口的虛擬主機(jī)這樣就配好了
3.2 基于IP
首先配置一個(gè)臨時(shí)IP
[root@ceph conf.d]# sudo ip addr add 192.168.1.100/24 dev ens33 [root@ceph conf.d]# ip a |grep 192.168.1.100 inet 192.168.1.100/24 scope global ens33
虛擬的IP就配置好了,接下來配置nginx
[root@ceph conf.d]# vim virthost.conf server { listen 81; root /web1; } server { listen 82; root /web2; } server { listen 192.168.200.210:80; root /web3; } server { listen 192.168.1.100:80; root /web4; }
然后我們創(chuàng)建對應(yīng)的網(wǎng)站根目錄以及index.html
[root@ceph conf.d]# echo 192.168.200.210 > /web3/index.html [root@ceph conf.d]# echo 192.168.1.100 > /web4/index.html [root@ceph conf.d]# systemctl restart nginx [root@ceph conf.d]# curl 192.168.200.210 192.168.200.210 [root@ceph conf.d]# curl 192.168.1.100 192.168.1.100
可以看到,通過不同的ip訪問回顯是不同的內(nèi)容
3.3 基于域名
[root@ceph conf.d]# vim virthost.conf server { listen 80; server_name test.com; root /web5; } server { listen 80; server_name example.com; root /web6; }
創(chuàng)建根目錄以及重啟服務(wù),還需要做hosts解析
[root@ceph conf.d]# echo web5 > /web5/index.html [root@ceph conf.d]# echo web6 > /web6/index.html [root@ceph conf.d]# systemctl restart nginx [root@ceph conf.d]# vim /etc/hosts 192.168.200.210 test.com 192.168.200.210 example.com [root@ceph conf.d]# curl test.com web5 [root@ceph conf.d]# curl example.com web6
這樣也是可以訪問到對應(yīng)的文件的
4. Location
這個(gè)是nginx最重要的配置了,在Apache里面訪問控制是用Directory
和Files
來做的,那么在nginx里面的做法就是location了
4.1 拒絕訪問
我不想你訪問網(wǎng)站根目錄下的/test.html,那么我的路由規(guī)則就應(yīng)該這樣寫,還是在虛擬主機(jī)里定義
[root@ceph conf.d]# vim virthost.conf server { listen 80; server_name test.com; root /web5; location /test.html { return 403; } }
我們來創(chuàng)建這個(gè)test.html文件,并嘗試訪問
[root@ceph conf.d]# echo "test file" > /web5/test.html [root@ceph conf.d]# systemctl restart nginx [root@ceph conf.d]# curl 192.168.200.210/test.html <html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
看到了嗎?他就返回的是403,這樣做之后,訪問test.html的請求就被拒絕掉了,但是如果我們需要拒絕掉所有以test開頭的文件呢?也是跟Apache一樣使用 * 號嗎?不,Nginx是另外的做法
4.2 拒絕訪問test開頭的所有文件
[root@ceph conf.d]# vim virthost.conf server { listen 80; server_name test.com; root /web5; location ^~ /test { return 403; } } [root@ceph conf.d]# echo test > /web5/test.1 [root@ceph conf.d]# echo test > /web5/test.2 [root@ceph conf.d]# systemctl restart nginx
我們在/web5下創(chuàng)建了test.1和test.2包括之前創(chuàng)建的test.html一共有3個(gè)test開頭的文件,那我們現(xiàn)在來嘗試訪問一下
[root@ceph conf.d]# curl 192.168.200.210/test.html -I HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 02 Jul 2024 09:09:49 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive [root@ceph conf.d]# curl 192.168.200.210/test.1 -I HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 02 Jul 2024 09:09:56 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive [root@ceph conf.d]# curl 192.168.200.210/test.xxx -I HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 02 Jul 2024 09:10:12 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive
看到了吧,盡管我們訪問一個(gè)不存在的文件,按道理應(yīng)該是返回404,但是這個(gè)文件是以test開頭,那么他會被拒絕訪問,不管這個(gè)文件存不存在
但是這樣配置,只能拒絕掉以test開頭的,我如果訪問的是Test,那么他就不會被拒絕了
[root@ceph conf.d]# curl 192.168.200.210/Test -I HTTP/1.1 404 Not Found Server: nginx Date: Tue, 02 Jul 2024 09:12:57 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive
對吧,因?yàn)槲覀儧]有這個(gè)資源,所以他返回了404,而不是403,說明沒有被拒絕,如果想忽略大小寫,可以這樣做
4.3 忽略大小寫
[root@ceph conf.d]# vim virthost.conf server { listen 80; server_name test.com; root /web5; location ~* /test { return 403; } }
只需要將^~
這個(gè)地方改為~*
,我們來訪問一下看看
[root@ceph conf.d]# curl -I 192.168.200.210/test HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 02 Jul 2024 09:15:17 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive [root@ceph conf.d]# curl -I 192.168.200.210/Test HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 02 Jul 2024 09:15:21 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive [root@ceph conf.d]# curl -I 192.168.200.210/TEst HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 02 Jul 2024 09:15:23 GMT Content-Type: text/html Content-Length: 146 Connection: keep-alive
現(xiàn)在的配置,不管你的大寫的TEST還是小寫的test,亦或者是大小寫都有的,一律都會被拒絕訪問
4.4 反向代理
我們還可以通過location來做反向代理,比如你現(xiàn)在訪問我網(wǎng)站下的/
那我就直接給你代理到baidu.com
去,你要搜索啥你自己去搜吧,你以為這個(gè)百度是我給你提供的,其實(shí)不然,我是把你的請求給到百度了
[root@ceph conf.d]# vim virthost.conf server { listen 80; server_name test.com; root /web5; location / { proxy_pass https://www.baidu.com; } }
看到了嗎?這是貨真價(jià)實(shí)的百度哦,可以搜索內(nèi)容的
怎么樣,你現(xiàn)在就搭建了一個(gè)反向代理,客戶端只知道他訪問的是192.168.200.210這個(gè)IP,他并不知道你把他的請求給了百度,所以客戶端會以為你就是百度
5. 配置https
nginx配置https的方式其實(shí)跟Apache是差不多的,直接告訴他你的密鑰文件放在哪,有2種方式可以配置https,第一種是直接改主配置文件,主配置文件里是有https段落的,只不過默認(rèn)被注釋了。
第二種方式就是自己寫一個(gè)虛擬主機(jī),我這里直接修改主配置文件
[root@ceph nginx]# vim nginx.conf server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name _; root /usr/share/nginx/html; ssl_certificate "/etc/nginx/server.crt"; ssl_certificate_key "/etc/nginx/server.key"; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
將這一段的注釋全部給放開,ssl只保留需要的這2行內(nèi)容,然后將證書地址改為你的證書的實(shí)際目錄就可以了,然后重啟nginx服務(wù)
6. Nginx熱升級
Nginx熱升級是指可以做到不停機(jī)升級Nginx的版本,yum安裝的Nginx是不支持熱升級的,如果想要熱升級Nginx,那么你的Nginx必須是源碼編譯安裝的
編譯安裝流程:
- 下載源碼包
- 解壓源碼包
- 執(zhí)行預(yù)編譯 ./configure
- 編譯 make
- 編譯安裝 make install
這是編譯安裝的流程
在執(zhí)行到第5步的時(shí)候,他就會將編譯好的二進(jìn)制文件放在objs目錄下,就是依賴于這個(gè)目錄下的二進(jìn)制文件我們才可以做到版本共存
nginx的熱升級原理主要依賴于以下幾個(gè)關(guān)鍵步驟:
- 啟動(dòng)新版本的nginx進(jìn)程:在進(jìn)行熱升級時(shí),首先啟動(dòng)一個(gè)新版本的nginx進(jìn)程,這個(gè)進(jìn)程會使用新的配置文件和程序文件。
- 舊版本nginx進(jìn)程繼續(xù)服務(wù):啟動(dòng)新版本nginx進(jìn)程后,舊版本的nginx進(jìn)程仍然繼續(xù)運(yùn)行,繼續(xù)處理客戶端的請求。
- 新舊版本的協(xié)調(diào)切換:新版本nginx進(jìn)程啟動(dòng)后,會逐漸接管處理新的客戶端請求。同時(shí),舊版本nginx進(jìn)程在處理完當(dāng)前已有的請求后逐漸退出。
- 共享監(jiān)聽端口:新舊版本的nginx進(jìn)程可以通過共享監(jiān)聽的網(wǎng)絡(luò)端口來實(shí)現(xiàn)平滑過渡。在大多數(shù)情況下,nginx會采用SO_REUSEPORT選項(xiàng)來允許多個(gè)進(jìn)程監(jiān)聽同一個(gè)端口。
- 無縫切換:由于新舊版本nginx進(jìn)程可以并行運(yùn)行并共享端口,因此在沒有中斷服務(wù)的情況下完成從舊版本到新版本的切換,實(shí)現(xiàn)了熱升級。
6.1 環(huán)境清理
如果你已經(jīng)使用yum安裝了,先卸載nginx
[root@ceph ~]# yum remove -y nginx
6.2 編譯安裝舊版本Nginx
在這里面找一個(gè)相對舊一點(diǎn)的版本,我這里下載一個(gè)1.26.1,然后將1.26.1升級到1.27.0
[root@ceph ~]# cd /opt/ [root@ceph opt]# wget https://nginx.org/download/nginx-1.26.1.tar.gz [root@ceph opt]# tar -zxf nginx-1.26.1.tar.gz [root@ceph opt]# cd nginx-1.26.1/ [root@ceph nginx-1.26.1]# ls auto CHANGES.ru configure html man src CHANGES conf contrib LICENSE README [root@ceph nginx-1.26.1]# ./configure --prefix=/usr/local/nginx
在這里執(zhí)行的時(shí)候他可能會報(bào)錯(cuò),根據(jù)他的報(bào)錯(cuò)你安裝相對應(yīng)的軟件包就好了
Configuration summary + using system PCRE2 library + OpenSSL library is not used + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
他執(zhí)行完之后會這樣輸出就是沒有錯(cuò)誤,可以繼續(xù)往下做
[root@ceph nginx-1.26.1]# make -j 4
-j 指定并行編譯的進(jìn)程數(shù)為4
[root@ceph nginx-1.26.1]# make install
???????6.3 啟動(dòng)舊版nginx
由于我們指定的安裝路徑是/usr/local/nginx,所以他會在這個(gè)目錄下生成一個(gè)sbin的目錄,這個(gè)目錄里面有一個(gè)二進(jìn)制文件nginx,執(zhí)行他就可以啟動(dòng)nginx
[root@ceph nginx-1.26.1]# cd /usr/local/nginx/sbin/ [root@ceph sbin]# ./nginx [root@ceph sbin]# curl -I 192.168.200.210 HTTP/1.1 200 OK Server: nginx/1.26.1 Date: Tue, 02 Jul 2024 11:27:47 GMT Content-Type: text/html Content-Length: 615 Last-Modified: Tue, 02 Jul 2024 11:25:09 GMT Connection: keep-alive ETag: "6683e395-267" Accept-Ranges: bytes
在server這一欄我們可以看見nginx的版本是1.26.1
6.4 下載新版nginx
現(xiàn)在我們將nginx升級到1.27.0
[root@ceph sbin]# cd /opt/ [root@ceph opt]# wget https://nginx.org/download/nginx-1.27.0.tar.gz [root@ceph opt]# tar -zxf nginx-1.27.0.tar.gz [root@ceph opt]# cd nginx-1.27.0/ [root@ceph nginx-1.27.0]# ./configure --prefix=/usr/local/nginx [root@ceph nginx-1.27.0]# make -j 4
這里非常需要注意,一定不要去執(zhí)行make install
了,因?yàn)閳?zhí)行這個(gè)命令的話會將原來的nginx全部覆蓋掉,我們只需要替換掉nginx的二進(jìn)制文件就好了
我們來到objs目錄
[root@ceph nginx-1.27.0]# ls auto CHANGES.ru configure html Makefile objs src CHANGES conf contrib LICENSE man README [root@ceph nginx-1.27.0]# cd objs/ [root@ceph objs]# ls autoconf.err nginx ngx_auto_config.h ngx_modules.c src Makefile nginx.8 ngx_auto_headers.h ngx_modules.o
這里面就有一個(gè)nginx的二進(jìn)制文件,先別著急啟動(dòng),我們先將老版本的nginx二進(jìn)制文件進(jìn)行備份
[root@ceph objs]# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak [root@ceph objs]# cd /usr/local/nginx/sbin/ [root@ceph sbin]# cp /opt/nginx-1.27.0/objs/nginx . cp: overwrite './nginx'? y [root@ceph sbin]# ./nginx -v nginx version: nginx/1.27.0
現(xiàn)在我們就已經(jīng)將1.27.0的二進(jìn)制文件拷貝到這個(gè)地方來了,接下來我們需要將nginx1.27.0也給啟動(dòng)起來。
你這時(shí)候可能會有疑問,80端口不是已經(jīng)被老版本的nginx給占用了嗎,我現(xiàn)在在啟動(dòng)不會報(bào)錯(cuò)嗎?答案肯定是會,所以我們在啟動(dòng)之前還需要進(jìn)行一個(gè)操作,給老版本的nginx'發(fā)送一個(gè)USR2
的信號
[root@ceph sbin]# ps -ef |grep nginx root 46538 1 0 19:27 ? 00:00:00 nginx: master process ./nginx nobody 46539 46538 0 19:27 ? 00:00:00 nginx: worker process root 49680 15412 0 19:36 pts/0 00:00:00 grep --color=auto nginx
我們查到nginx master的進(jìn)程id是46538,接下來就是發(fā)信號了
[root@ceph sbin]# kill -s USR2 46538 # 然后我們再啟動(dòng)nginx [root@ceph sbin]# ps -ef |grep nginx root 46538 1 0 19:27 ? 00:00:00 nginx: master process ./nginx nobody 46539 46538 0 19:27 ? 00:00:00 nginx: worker process root 49708 46538 0 19:37 ? 00:00:00 nginx: master process ./nginx nobody 49709 49708 0 19:37 ? 00:00:00 nginx: worker process root 49761 15412 0 19:38 pts/0 00:00:00 grep --color=auto nginx
看到了嗎?除了老版本的46538之外,還有一個(gè)新的nginx master進(jìn)程,49708
嘗試訪問
[root@ceph sbin]# curl 192.168.200.210 -I HTTP/1.1 200 OK Server: nginx/1.27.0 Date: Tue, 02 Jul 2024 11:39:04 GMT Content-Type: text/html Content-Length: 615 Last-Modified: Tue, 02 Jul 2024 11:25:09 GMT Connection: keep-alive ETag: "6683e395-267" Accept-Ranges: bytes
看,他現(xiàn)在處理連接的版本就是1.27.0了,如果老版本的nginx還有連接在處理的話也是不會受到影響的,等我們確認(rèn)沒問題之后我們只需要將老版本給kill掉
[root@ceph sbin]# kill 46538 [root@ceph sbin]# ps -ef |grep nginx root 49708 1 0 19:37 ? 00:00:00 nginx: master process ./nginx nobody 49709 49708 0 19:37 ? 00:00:00 nginx: worker process root 49913 15412 0 19:40 pts/0 00:00:00 grep --color=auto nginx
這個(gè)時(shí)候老版本就成功退役了,所有的連接都交由新版本的nginx來處理,我們的熱升級就搞定了
到此這篇關(guān)于Nginx配置以及熱升級的文章就介紹到這了,更多相關(guān)Nginx熱升級內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
詳解Nginx 靜態(tài)文件服務(wù)配置及優(yōu)化
這篇文章主要介紹了Nginx 靜態(tài)文件服務(wù)配置及優(yōu)化,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-05-05Nginx服務(wù)器下使用rewrite重寫url以實(shí)現(xiàn)偽靜態(tài)的示例
這篇文章主要介紹了Nginx服務(wù)器下使用rewrite重寫url以實(shí)現(xiàn)偽靜態(tài)的示例,這里舉了Discuz!和WordPress這兩個(gè)常用的PHP程序,需要的朋友可以參考下2015-12-12關(guān)于nginx沒有跳轉(zhuǎn)到upstream地址的解決
這篇文章主要介紹了關(guān)于nginx沒有跳轉(zhuǎn)到upstream地址的解決,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09nginx代理多次302的解決方法(nginx Follow 302)
這篇文章主要介紹了nginx代理多次302的解決方法(nginx Follow 302),詳細(xì)的介紹了解決方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-12-12Nginx學(xué)習(xí)之靜態(tài)文件服務(wù)器配置方法
本篇文章主要介紹了Nginx學(xué)習(xí)之靜態(tài)文件服務(wù)器配置方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-02-02nginx禁止直接通過ip進(jìn)行訪問并跳轉(zhuǎn)到自定義500頁面的操作
這篇文章主要介紹了nginx禁止直接通過ip進(jìn)行訪問并跳轉(zhuǎn)到自定義500頁面的操作,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-05-05