国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

nginx ,把類似 /page/123_index.json的請求重定向為 /page/index.json請問怎麼配置?
天蓬老師
天蓬老師 2017-05-16 17:10:33
0
2
798
location ~ ^/pages/\d+_index.json{
    proxy_pass /pages/index.json;
}

試了一下不行
我對nginx配置不太熟悉,請教了.

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見證您的進步~~

全部回覆(2)
PHPzhong

你可以使用 rewrite 重寫你的請求路徑

    location / {
        rewrite ^/pages/\d+_index\.json /pages/index.json break;
        proxy_pass http://127.0.0.1:8080;
    }
    # 測試下 會返回重寫后的 url /pages/index.json
    location = /pages/index.json {
        return 200 $request_uri;
    }
阿神

我找到了兩個解決的方法
rewrite:

location ~ ^/pages/{
     rewrite ^/pages/(\d+)/\d+_index.json   http://$host/pages//index.json break;
}

proxy_pass

location ~ ^/pages/(\d+)/\d+_index.json$ {
    proxy_pass http://$host/pages//index.json;
}
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板