INSIGHT & DETAIL

深度解读行业趋势与实践

深度解读行业趋势与技术实践,为企业数字化转型提供参考。

安企CMS技术
当前位置 首页 / 安企CMS技术

安企CMS的llms.txt文件用谷歌浏览器打开是乱码解决方法!

安企CMS的llms.txt文件用谷歌浏览器打开是乱码解决方法!

如图:

ScreenShot_2026-08-13_185347_118

代码如下:

   location @AnqiCMS {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
    error_page 404 =200  @AnqiCMS;
    location / {
       try_files $uri $uri/index.html @AnqiCMS;
    }
    # 专门处理 .txt 结尾的文件
    location ~* \.txt$ {
        # 强制设置内容类型为 text/plain 并指定 UTF-8 编码
        default_type text/plain;
        charset utf-8;
        
        # 如果 default_type 不生效,可以使用 add_header 强制覆盖(需配合 always)
        # add_header Content-Type "text/plain; charset=utf-8" always;
    }
相关文章