nginx代理出现的问题

之前配置这么写的:

location ~/test/iframeTest {
            root   D:/software/nginx-1.18.0/nginx-1.18.0/html/iframeTest;
            index  iframeChild.html;
        }

因为

iframeChild.html在
iframeTest目录下

后面发现这么调用不通,原因在于读取路径的时候最后会是这样的路径:
 D:/software/nginx-1.18.0/nginx-1.18.0/html/iframeTest/test/iframeTest

所以后面改成了

        location ~/iframeTest {
            root   D:/software/nginx-1.18.0/nginx-1.18.0/html;
            index  iframeChild.html;
        }

这样的路径,访问正常,才知道location后面的路径会自动拼接到root后面,这个在配置的时候要注意

 
posted @ 2021-09-09 20:45  洛晨随风  阅读(196)  评论(0)    收藏  举报