【发布时间】:2020-02-20 15:23:34
【问题描述】:
这是我的问题
我最近在学习nginx
而且我不知道为什么我可以处理关于位置的配置
这是我的 nginx.conf
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root /Users/billyliou/web-site;
location / {
root html;
index index.html;
}
location /demo {
index index.html index.htm;
try_files $uri $uri/ /demo/index.html?s=$uri&$args;
}
location /test {
index index.html index.htm;
try_files $uri $uri/ /test/index.html?s=$uri&$args;
}
...
我将两个文件夹放入'/Users/billyliou/web-site'
一个是demo,一个是test。
两者都包含 index.html。
当我输入 localhost:8080 时,它会显示 nginx 默认页面。 当我输入 localhost:8080/demo 时,它会显示演示页面。 但是当我输入 localhost:8080/test 时,它也会显示演示页面。 最后一个出乎我的意料。
如何设置此配置?
【问题讨论】:
标签: nginx