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后面,这个在配置的时候要注意

 
积累小的知识,才能成就大的智慧,希望网上少一些复制多一些原创有用的答案
原文地址:https://www.cnblogs.com/llcdbk/p/15248733.html