V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
creedowl
V2EX  ›  NGINX

docker 下 nginx 链接斜杠问题?

  •  
  •   creedowl · 2018-03-11 18:25:30 +08:00 · 2706 次点击
    这是一个创建于 2208 天前的主题,其中的信息可能已经有所发展或是发生改变。

    容器中的 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/ (另一个容器的应用), 请问要如何解决

    4 条回复    2018-03-23 15:38:10 +08:00
    feverzsj
        1
    feverzsj  
       2018-03-11 18:29:40 +08:00
    /files 不是路径,/files/才是
    creedowl
        2
    creedowl  
    OP
       2018-03-11 18:32:33 +08:00
    @feverzsj 那要如何做到访问 http://192.168.6.235:55555/files 自动跳转到 http://192.168.6.235:55555/files/ 呢
    creedowl
        3
    creedowl  
    OP
       2018-03-12 18:17:36 +08:00
    有人吗。。
    sajesemuy
        4
    sajesemuy  
       2018-03-23 15:38:10 +08:00
    ```
    server_name localhost:55555;
    server_name_in_redirect on;
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5534 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 09:04 · PVG 17:04 · LAX 02:04 · JFK 05:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.