我一直在試圖找出什麼是錯的,我的regex
或nginx config
。我有以下位置塊在我的nginx的配置nginx匹配位置與正則表達式
location ~ /v1/(tests|my/.*/tests|your/.*/test|our/.*/testers) {
proxy_pass http://127.0.0.1:8000;
}
的Nginx在端口8080
運行,我有一個簡單的測試Web服務器上的端口8000
運行。我用下列路徑
http://localhost:8080/v1/tests
(工程)http://localhost:8080/v1/my/a1/tests
(工程)http://localhost:8080/v1/my/%20/tests
(工程)http://localhost:8080/v1/my//tests
(與 nginx的服務器上失敗)http://localhost:8080/v1/my/%2F/tests
測試本(在nginx服務器上失敗,)
我想知道爲什麼這是因爲我匹配my/.*/tests
,它應該也匹配空字符串呢?我錯過了什麼嗎?
感謝幫助!
你在你的正則表達式中有'writters'而不是'tests'。 –
哪臺服務器生成404? –
@RichardSmith運行nginx的服務器返回** 404 ** – digerati