docker 下 nginx 链接斜杠问题?

2018-03-11 18:25:30 +08:00
 creedowl

容器中的 80 映射到主机 55555 端口,配置了一个文件目录 inedx

server {
    listen 80;
    # server_name localhost:80;
    location /files {
        root /home;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        expires 30d;
    }
}

现在外部访问 http://192.168.6.235:55555/files/ 正常访问, 但访问 http://192.168.6.235:55555/files 就跳转到 http://192.168.6.235/files/ (另一个容器的应用), 请问要如何解决

2736 次点击
所在节点    NGINX
4 条回复
feverzsj
2018-03-11 18:29:40 +08:00
/files 不是路径,/files/才是
creedowl
2018-03-11 18:32:33 +08:00
@feverzsj 那要如何做到访问 http://192.168.6.235:55555/files 自动跳转到 http://192.168.6.235:55555/files/ 呢
creedowl
2018-03-12 18:17:36 +08:00
有人吗。。
sajesemuy
2018-03-23 15:38:10 +08:00
```
server_name localhost:55555;
server_name_in_redirect on;
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/437023

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX