› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
creedowl
V2EX  ›  NGINX

docker 下 nginx 链接斜杠问题?

  •  
  •   creedowl · Mar 11, 2018 · 3933 views
    This topic created in 3174 days ago, the information mentioned may be changed or developed.

    容器中的 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 replies  •  2018-03-23 15:38:10 +08:00
    feverzsj
    feverzsj
    Mar 11, 2018
    1
    /files 不是路径,/files/才是
    creedowl
    creedowl
    OP
    Mar 11, 2018
    2
    @feverzsj 那要如何做到访问 http://192.168.6.235:55555/files 自动跳转到 http://192.168.6.235:55555/files/ 呢
    creedowl
    creedowl
    OP
    Mar 12, 2018
    3
    有人吗。。
    sajesemuy
    sajesemuy
    Mar 23, 2018
    4
    ```
    server_name localhost:55555;
    server_name_in_redirect on;
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2354 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 12:41 · PVG 20:41 · LAX 04:41 · JFK 07:41
    ♥ Do have faith in what you're doing.