NginxRewrite原理和實(shí)際操作-創(chuàng)新互聯(lián)

Nginx Rewrite

Nginx Rewrite
一、問題引出+理論講解
1.1何為Nginx Rewrite?
1.1.1什么是URL?
1.1.2“跳轉(zhuǎn)有什么用?
1.1.3Per是什么語(yǔ)言?
1.2如何實(shí)現(xiàn)Rewrite跳轉(zhuǎn)?
1.2.1Rwrite實(shí)用場(chǎng)景
1.2 2命令語(yǔ)法
1.2 3location分類
1.2 4location優(yōu)先級(jí)
1.2.5比較rewrite和location
1.2 6location優(yōu)先級(jí)規(guī)則
二、 根據(jù)不同應(yīng)用場(chǎng)景 下實(shí)現(xiàn)Nginx Rewrite的配置實(shí)例
2.1 rewrite規(guī)則配置應(yīng)用場(chǎng)景:基于域名的跳轉(zhuǎn)
2.2 rewrite規(guī)則配置應(yīng)用場(chǎng)景二:基于ip地址
2.3 rewrite規(guī)則配置應(yīng)用場(chǎng)景三:基于跳轉(zhuǎn)到新域名后面有目錄的情況
2.4 rewrite規(guī)則配置應(yīng)用場(chǎng)景四:基于多參數(shù)匹配
2 5 rewrite規(guī)則配置應(yīng)用場(chǎng)景五:基于文件后綴名訪問
2 6 rewrite規(guī)則配置應(yīng)用場(chǎng)景六:基于指定文件(具體頁(yè)面)匹配
三、總結(jié)

創(chuàng)新互聯(lián)云計(jì)算的互聯(lián)網(wǎng)服務(wù)提供商,擁有超過13年的服務(wù)器租用、BGP機(jī)房服務(wù)器托管、云服務(wù)器、網(wǎng)站空間、網(wǎng)站系統(tǒng)開發(fā)經(jīng)驗(yàn),已先后獲得國(guó)家工業(yè)和信息化部頒發(fā)的互聯(lián)網(wǎng)數(shù)據(jù)中心業(yè)務(wù)許可證。專業(yè)提供云主機(jī)、網(wǎng)站空間、申請(qǐng)域名、VPS主機(jī)、云服務(wù)器、香港云服務(wù)器、免備案服務(wù)器等。

一、問題引出+理論講解

1.1何為Nginx Rewrite?

? Nginx Rwrite ——Nginx服務(wù)的規(guī)則重寫,主要的功能是實(shí)現(xiàn)瀏覽器訪問HTTP URL的跳轉(zhuǎn),其中相關(guān)的正則表達(dá)式是基于Perl語(yǔ)言。一般來(lái)說,幾乎所有的Web服務(wù)器都支持URL重寫。

? 或許你看到這里你可能產(chǎn)生以下幾個(gè)疑問:

  1. 什么是URL?
  2. 實(shí)現(xiàn)HTTP URL跳轉(zhuǎn)有什么用?
  3. Perl語(yǔ)言是什么?

下面逐一解答:

1.1.1什么是URL?

? 對(duì)于百度給出的定義如下:URL(Uniform Resource Locator),統(tǒng)一資源定位符。這樣的表述似乎過于抽象,因?yàn)榭赡芨静涣私馐裁词恰敖y(tǒng)一資源定位符”?其實(shí)我們可以將URL簡(jiǎn)易地理解為你所需要通過網(wǎng)絡(luò)獲取資源的地址,(URL)是由一串字符組成,這些字符可以是字母,數(shù)字和特殊符號(hào)。

具體實(shí)例如下:

php+HTML
http://www.wangluopx.cn/yunwei/gz/zz/2018-07-03/1940.html

其具體結(jié)構(gòu)在這就不做詳細(xì)闡述了,有興趣可以自行查閱相關(guān)文檔。

1.1.2“跳轉(zhuǎn)”有什么用?

? 跳轉(zhuǎn)需要根據(jù)具體的應(yīng)用場(chǎng)景才能真正體會(huì)到nginx規(guī)則重寫實(shí)現(xiàn)網(wǎng)頁(yè)跳轉(zhuǎn)的作用。稍后會(huì)根據(jù)不同的應(yīng)用場(chǎng)景進(jìn)行對(duì)應(yīng)的操作與設(shè)置。一般來(lái)說,實(shí)現(xiàn)跳轉(zhuǎn)的作用可以總結(jié)為以下幾個(gè)方面:

  1. 調(diào)整用戶瀏覽的URL,使其規(guī)范;
  2. 使搜索引擎收錄網(wǎng)站內(nèi)容,提升用戶的使用體驗(yàn);
  3. 隱藏網(wǎng)站URL真實(shí)地址等;

1.1.3Perl是什么語(yǔ)言?

? 這里我們不是說需要具備Perl的基礎(chǔ)才行,其實(shí)我們懂得或者理解了shell中的正則表達(dá)式也是可以理解本文所講述的相關(guān)內(nèi)容。

? 就語(yǔ)言方面而言,Perl 借取了C、sed、awk、shell腳本語(yǔ)言以及很多其他程序語(yǔ)言的特性,其中最重要的特性是它內(nèi)部集成了正則表達(dá)式的功能,以及巨大的第三方代碼庫(kù)CPAN。簡(jiǎn)而言之,Perl像C一樣強(qiáng)大,像awk、sed等腳本描述語(yǔ)言一樣方便,被Perl語(yǔ)言愛好者稱之為“一種擁有各種語(yǔ)言功能的夢(mèng)幻腳本語(yǔ)言”、“Unix中的王牌工具。

? 鼓勵(lì)有語(yǔ)言研究學(xué)習(xí)興趣的愛好者可以進(jìn)行學(xué)習(xí)。

1.2如何實(shí)現(xiàn)Rewrite跳轉(zhuǎn)?

? rewrite使用Nginx全局變量或自己設(shè)置的變量,結(jié)合正則表達(dá)式和標(biāo)志位實(shí)現(xiàn)URL重寫以及重定向
,基于ngx_http_rewrite_module模塊進(jìn)行處理。

1.2.1Rwrite 實(shí)用場(chǎng)景

Nginx跳轉(zhuǎn)需求的實(shí)現(xiàn)方式

? ●使用rewrite進(jìn)行匹配跳轉(zhuǎn)
? ●使用if匹配全局變量后跳轉(zhuǎn)
? ●使用location匹配再跳轉(zhuǎn)

rewrite放在server{},if{},location{}段中

對(duì)域名或參數(shù)字符串

? ●使用if全局變量匹配
? ●使用proxy_ pass反向代理

1.2.2命令語(yǔ)法

rewrite <regex> <replacement> [flag];
正則 跳轉(zhuǎn)后的內(nèi)容 rewrite支持的flag

1.2.3location分類

location = patt{}[精準(zhǔn)匹配]
location patt{} [一般匹配]
location ~patt{} [正則匹配]
正則匹配的常用表達(dá)式

標(biāo)記 說明
~ 執(zhí)行一個(gè)正則匹配,區(qū)分大小寫
~ 執(zhí)行一個(gè)正則匹配,不區(qū)分大小寫
!~ 執(zhí)行一個(gè)正則匹配,區(qū)分大小寫不匹配
!~
執(zhí)行一個(gè)正則匹配,不區(qū)分大小寫不匹配
^~ 普通字符匹配;使用前綴匹配。如果匹配成功,則不再匹配其他location
= 普通字符精確匹配。也就是完全匹配
@ 定義一個(gè)命名的location,使用在內(nèi)部定向時(shí)

1.2.4location優(yōu)先級(jí)

1.相同類型的表達(dá)式,字符串長(zhǎng)的會(huì)優(yōu)先匹配
2.按優(yōu)先級(jí)排列
●=類型
●^~類型表達(dá)式
●正則表達(dá)式(~和~*)類型
●常規(guī)字符串匹配類型,按前綴匹配
●通用匹配(/) ,如果沒有其它匹配,任何請(qǐng)求都會(huì)匹配到

1.2.5比較rewrite和location

1.相同點(diǎn)
●都能實(shí)現(xiàn)跳轉(zhuǎn)
2.不同點(diǎn)
●rewrite是在同一域名內(nèi)更改獲取資源的路徑
●location是對(duì)一類路徑做控制訪問或反向代理,還可以proxy_ pass
到其他機(jī)器
3.rewrite會(huì)寫在location里,執(zhí)行順序:
●執(zhí)行server塊里面的rewrite指令
●執(zhí)行l(wèi)ocation匹配
●執(zhí)行選定的location中的rewrite指令

1.2.6location優(yōu)先級(jí)規(guī)則

匹配某個(gè)具體文件
●(location =完整路徑) > (location ^~完整路徑) > (location ~完整
路徑) > (location ~完整路徑) > (location 完整路徑) > (location /)
用目錄做匹配訪問某個(gè)文件
●(location=目錄) > (location ^~目錄/) > (location~目錄) >
(location ~
目錄) > (location 目錄) > (location /)

二、根據(jù)不同應(yīng)用場(chǎng)景下實(shí)現(xiàn)Nginx Rewrite的配置實(shí)例

首先我們先安裝好域名解析named服務(wù)包——bind以及nginx服務(wù)(也可以使用手工編譯,這里我們使用yum直接安裝)

1.安裝bind設(shè)置配置文件(三個(gè))并開啟服務(wù)

[root@localhost ~]# yum install bind -y
[root@localhost named]# netstat -napt | grep named
tcp        0      0 192.168.68.145:53       0.0.0.0:*               LISTEN      6077/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      6077/named          
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      6077/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      6077/named          
tcp6       0      0 ::1:953                 :::*                    LISTEN      6077/named

2.安裝nginx

我們會(huì)看到直接使用yum安裝無(wú)法成功的

[root@localhost ~]# yum install -y nginx
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
沒有可用軟件包 nginx。
錯(cuò)誤:無(wú)須任何處理
[root@localhost ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
獲取http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
警告:/var/tmp/rpm-tmp.aXVptL: 頭V4 RSA/SHA1 Signature, 密鑰 ID 7bd9bf62: NOKEY
準(zhǔn)備中...                          ################################# [100%]
正在升級(jí)/安裝...
   1:nginx-release-centos-7-0.el7.ngx ################################# [100%]
[root@localhost ~]# yum install -y nginx
...省略部分內(nèi)容

3.檢查安裝是否成功,查看配置文件目錄

[root@localhost ~]# rpm -q nginx
nginx-1.16.1-1.el7.ngx.x86_64
[root@localhost ~]# rpm -qc nginx
/etc/logrotate.d/nginx
/etc/nginx/conf.d/default.conf   #這是我們待會(huì)做rewrite需要配置更改的文件
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug

2.1 rewrite規(guī)則配置應(yīng)用場(chǎng)景一:基于域名的跳轉(zhuǎn)

? 簡(jiǎn)單解釋一下該場(chǎng)景:某公司出于某些原因需要將舊的域名修改為新的域名,但是新的域名大家都比較陌生,所以就需要進(jìn)行舊——新的跳轉(zhuǎn),即:客戶機(jī)上訪問該舊的域名時(shí)可以自動(dòng)跳轉(zhuǎn)到新的域名,客戶經(jīng)過多次訪問,發(fā)現(xiàn)只要輸入新的域名就能訪問了,而且輸入更加簡(jiǎn)單友好。

? 下面我們結(jié)合上述的場(chǎng)景來(lái)具體闡述如何進(jìn)行配置:

1.首先我們是yum安裝的,上面已經(jīng)注釋了其主配置文件(是一個(gè)默認(rèn)的配置文件,功能必然沒有手工編譯豐富):/etc/nginx/conf.d/default.conf,簡(jiǎn)要介紹一下其文件內(nèi)容結(jié)構(gòu)

[root@localhost named]# cd /etc/nginx/conf.d/
[root@localhost conf.d]# ls
default.conf
[root@localhost conf.d]# cat default.conf 
server {
    listen       80;                           #監(jiān)聽端口
    server_name  localhost;                    #域名,一般是指服務(wù)器的域名

    #charset koi8-r;                          #字符設(shè)置 
    #access_log  /var/log/nginx/host.access.log  main;      #訪問日志路徑設(shè)置

    location / {    #location 有”定位”的意思, 根據(jù)Uri來(lái)進(jìn)行不同的定位,Uri可以理解為資源對(duì)應(yīng)于URL是地址
        root   /usr/share/nginx/html;      
        index  index.html index.htm;
    }
    #location可以把網(wǎng)站的不同部分,定位到不同的處理方式上

    #error_page  404              /404.html;    #404訪問錯(cuò)誤頁(yè)面找不到

    # redirect server error pages to the static page /50x.html           
    #
    error_page   500 502 503 504  /50x.html;              #錯(cuò)誤頁(yè)面,服務(wù)器出問題
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

2.更改配置操作:更改域名、域名重定向

 server {
    listen       80;                    
    server_name  www.lokott.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        if ($host = 'www.lokott.com'){
                rewrite ^/(.*)$ http://www.newlokott.com/$1 permanent;
        }

3.開啟nginx服務(wù)關(guān)閉防火墻

[root@localhost conf.d]# systemctl start nginx
[root@localhost conf.d]# systemctl stop firewalld.service 
[root@localhost conf.d]# setenforce 0

4.測(cè)試是否正常跳轉(zhuǎn)

在win10上輸入舊的域名:www.lokott.com是否正常跳轉(zhuǎn)為www.newlokott.com

舊域名輸入界面,按完回車后跳轉(zhuǎn)為下面第二張界面,可以驗(yàn)證的確將舊域名跳轉(zhuǎn)到新的域名了。

Nginx Rewrite原理和實(shí)際操作

Nginx Rewrite原理和實(shí)際操作

2.2 rewrite規(guī)則配置應(yīng)用場(chǎng)景二:基于ip地址

? 簡(jiǎn)單描述:公司網(wǎng)頁(yè)正在做維護(hù)或者結(jié)構(gòu)調(diào)整,目前只允許合法的ip地址訪問公司的頁(yè)面,其他的就跳轉(zhuǎn)到維護(hù)或者其他頁(yè)面。

具體配置:

1.設(shè)置一個(gè)合法的標(biāo)志位;set $rewrite true;

2.判斷是否是合法的IP,是就正常跳轉(zhuǎn),否則跳轉(zhuǎn)為main.html頁(yè)面;

[root@localhost ~]# vim /etc/nginx/conf.d/default.conf 
[root@localhost ~]# cat /etc/nginx/conf.d/default.conf 
server {
    listen       80;
    server_name  www.lokott.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    set $rewrite true;                      #由此開始配置場(chǎng)景二
    if ($remote_addr = "192.168.68.151"){
        set $rewrite false;
    }   

    if ($rewrite = true){
        rewrite (.+) /main.html;
    }

    location = /main.html {
        root /usr/share/nginx/html;
    }                                       #到此配置二結(jié)束

    location / {
        #if ($host = 'www.lokott.com'){     #注釋場(chǎng)景一的配置
        #       rewrite ^/(.*)$ http://www.newlokott.com/$1 permanent;
        #}
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

3.將main.html頁(yè)面寫到/usr/share/nginx/html/下

[root@localhost ~]# cd /usr/share/nginx/html/
[root@localhost html]# ls
50x.html  index.html
[root@localhost html]# echo "this is a maintenance web page" > main.html
[root@localhost html]# ls
50x.html  index.html  main.html

4.重啟nginx服務(wù),然后之后檢驗(yàn)

[root@localhost html]# systemctl restart nginx
[root@localhost html]# netstat -antp | grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      64979/nginx: master 

5.根據(jù)上面的配置,結(jié)果應(yīng)該是IP地址為192.168.68.151的主機(jī)是可以正常訪問的,其他的則無(wú)法訪問。

實(shí)際的結(jié)果如下:

Nginx Rewrite原理和實(shí)際操作

換一臺(tái)centos虛擬機(jī)測(cè)試則無(wú)法訪問正常的頁(yè)面

Nginx Rewrite原理和實(shí)際操作

下面,我們對(duì)于剛剛配置文件的內(nèi)容做邏輯層面上的梳理與對(duì)應(yīng)解釋:

截取關(guān)鍵部分的配置命令:

set $rewrite true; #設(shè)置一個(gè)標(biāo)志位用來(lái)進(jìn)行不同的判斷從而觸發(fā)不同的操作過程
if ($remote_addr = "192.168.68.151"){ #判斷請(qǐng)求訪問的主機(jī)ip地址是否是被允許的(只有該地址有權(quán)限進(jìn)行正常訪問)
set $rewrite false; #更改標(biāo)志位的值,從而不觸發(fā)原本為true的操作,即不執(zhí)行下面兩段的操作
}

if ($rewrite = true){ #若是非法地址訪問則該標(biāo)志位仍然為true,從而執(zhí)行該段內(nèi)容
rewrite (.+) /main.html;
}

location = /main.html { #基于上面的true匹配在精確匹配進(jìn)行具體操作執(zhí)行的定位,訪問的是維護(hù)頁(yè)面
root /usr/share/nginx/html;
}

所以根據(jù)邏輯上的理解,我們知道只有被設(shè)置為允許的ip地址的客戶機(jī)才能正常訪問公司頁(yè)面,則其他的沒有改權(quán)限,相當(dāng)于做了一個(gè)“白名單”。

2.3 rewrite規(guī)則配置應(yīng)用場(chǎng)景三:基于跳轉(zhuǎn)到新域名后面有目錄的情況

場(chǎng)景簡(jiǎn)述:加入訪問的是www.lokott.com/p,現(xiàn)在需要將這個(gè)域名下面的發(fā)帖都跳轉(zhuǎn)到bbs.lokott.com/ss/p,

1.我們?nèi)匀粚?duì)默認(rèn)主配置文件進(jìn)行修改

[root@localhost ~]# cat /etc/nginx/conf.d/default.conf 
server {
    listen       80;
    server_name  www.lokott.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    set $rewrite true;
    if ($remote_addr = "192.168.68.151"){
        set $rewrite false;
    }   

    if ($rewrite = true){
        rewrite (.+) /main.html;
    }

    location = /main.html {
        root /usr/share/nginx/html;
    }

    location /p {                                      #第三個(gè)場(chǎng)景配置
        rewrite (.+) http://bbs.lokott.com/ss$1 permanent;    
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

2.重啟服務(wù)

[root@localhost html]# systemctl restart nginx

3.在win10虛擬機(jī)上測(cè)試

Nginx Rewrite原理和實(shí)際操作

Nginx Rewrite原理和實(shí)際操作

由此現(xiàn)象可見,上述$1的含義是:你所定義的location的/p目錄之后的內(nèi)容,具體為何需要你自己創(chuàng)建站點(diǎn),例如:

在/usr/local/nginx/html目錄下創(chuàng)建ss/p/index.html網(wǎng)頁(yè),網(wǎng)頁(yè)內(nèi)容為“hello world” ,在使用http://www.lokott.com/p/index訪問時(shí)將會(huì)如下圖跳轉(zhuǎn):

Nginx Rewrite原理和實(shí)際操作

2.4 rewrite規(guī)則配置應(yīng)用場(chǎng)景四:基于多參數(shù)匹配

場(chǎng)景簡(jiǎn)述:在訪問www.lokott.com域名時(shí)在后面輸入已經(jīng)規(guī)定的參數(shù),實(shí)現(xiàn)規(guī)則跳轉(zhuǎn),例如:輸入http://www.lokott.com/100-200-4454.html則跳到首頁(yè)

1.更改配置文件

server {
    listen       80;
    server_name  www.lokott.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    if ($request_uri ~ ^/100-(100|200)-(\d+).html$){     #第四個(gè)場(chǎng)景
        rewrite (.*) http://www.lokott.com permanent;      //
    }
    #上述涉及的正則:^——開頭 | 或   \ 轉(zhuǎn)義  d+ 數(shù)字匹配
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

2.重啟服務(wù)

[root@localhost html]# systemctl restart nginx
[root@localhost html]# echo "asda" > 100-200-4454.html
[root@localhost html]# ls
100-200-4454.html  50x.html  index.html 
[root@localhost html]# echo "asda" > 100.html

3.測(cè)試驗(yàn)證

Nginx Rewrite原理和實(shí)際操作

Nginx Rewrite原理和實(shí)際操作

在站點(diǎn)目錄在創(chuàng)建一個(gè)100.html文件,內(nèi)容為asda,然后進(jìn)行測(cè)試,結(jié)果如下:

Nginx Rewrite原理和實(shí)際操作

2.5 rewrite規(guī)則配置應(yīng)用場(chǎng)景五:基于文件后綴名訪問

場(chǎng)景簡(jiǎn)述:訪問upload目錄下的php文件時(shí)跳轉(zhuǎn)至主頁(yè)面

1.修改配置文件

server {
    listen       80;
    server_name  www.lokott.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location ~* /upload/.+\.php$ {                       #第五個(gè)場(chǎng)景
        rewrite (.+) http://www.lokott.com permanent;
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

2.重啟服務(wù)

[root@localhost html]# systemctl restart nginx

3.測(cè)試驗(yàn)證

Nginx Rewrite原理和實(shí)際操作

跳轉(zhuǎn)的頁(yè)面:

Nginx Rewrite原理和實(shí)際操作

2.6 rewrite規(guī)則配置應(yīng)用場(chǎng)景六:基于指定文件(具體頁(yè)面)匹配

場(chǎng)景簡(jiǎn)述:訪問固定的頁(yè)面時(shí)跳轉(zhuǎn)到首頁(yè)

1.修改配置文件

server {
    listen       80;
    server_name  www.lokott.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location ~* ^/abc/123.html {                         #第六個(gè)場(chǎng)景
        rewrite (.+) http://www.lokott.com permanent;
    }
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

2.重啟服務(wù)

[root@localhost html]# systemctl restart nginx

3.測(cè)試驗(yàn)證

Nginx Rewrite原理和實(shí)際操作

跳轉(zhuǎn)頁(yè)面如下:

Nginx Rewrite原理和實(shí)際操作

三、總結(jié)

? 本文主要講解Nginx Rewrite的概念,結(jié)合6個(gè)不同的使用場(chǎng)景介紹如何對(duì)nginx配置文件的修改從而實(shí)現(xiàn)跳轉(zhuǎn)網(wǎng)站頁(yè)面的實(shí)現(xiàn)。

網(wǎng)站題目:NginxRewrite原理和實(shí)際操作-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://muchs.cn/article24/dpijce.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、電子商務(wù)、標(biāo)簽優(yōu)化、外貿(mào)建站、面包屑導(dǎo)航、ChatGPT

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司