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

Nginx 二级子目录配置问题

  •  
  •   ialva · Apr 6, 2018 · 4448 views
    This topic created in 2979 days ago, the information mentioned may be changed or developed.
    现状:
    1、非 Programmer,菜鸡;
    2、腾讯云,未备案,此前装了一个 typecho ( https://domain/typecho )和 nextcloud ( https://domain/nextcloud ),访问 https://domain 自动跳转到 typecho,typecho 几乎不使用,主要用 nextcloud 同步个人文档;
    3、近期安装了一个 mindoc ( http://ip:8100 ),目前通过修改 Nginx 配置文件,虽然实现了 https://domain/mindoc 的访问,但是打开的页面显示布局、图片等不正常,同时也测试过 http://ip/mindoc 也是一样的显示问题。
    配置文件修改内容:
    #设置 mindoc 运行在二级子目录
    location /mindoc/ {
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_redirect off;
    #此处配置 MinDoc 程序的地址和端口号
    proxy_pass http://127.0.0.1:8100/;

    请问各位大佬,出现异常的原因可能是什么?求指点。
    4 replies    2018-04-07 10:28:36 +08:00
    JHerschel
        1
    JHerschel  
       Apr 6, 2018
    用开发者模式查看资源请求的 url 是什么,如果资源是绝对定位(/static/xxx/xxx.css ),那么很有可能没有被你设置的 location 捕获到。
    jininij
        2
    jininij  
       Apr 6, 2018 via iPhone
    如果资源请求的是「/」开头的内容, 修改模板 在 html head 中添加<base href=“ https://domain/mindoc ”></base>
    如果资源请求的是 http://ip:8100/ 开头的内容。在 nginx 配置里添加 sub_filter http://ip:8100/ /mindoc
    meszyouh
        3
    meszyouh  
       Apr 6, 2018 via Android
    是不是又在配置文件级对 静态资源加了缓存啥的配置?正则优先于 普通的 location
    ialva
        4
    ialva  
    OP
       Apr 7, 2018
    @JHerschel 确实是这个原因
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   953 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 36ms · UTC 21:58 · PVG 05:58 · LAX 14:58 · JFK 17:58
    ♥ Do have faith in what you're doing.