File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 11<!doctype html>
2- < html lang ="">
2+ < html lang ="zh-CN ">
33 < head >
44 < meta charset ="UTF-8 " />
55 < link rel ="icon " href ="/favicon.png " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0, viewport-fit=cover " />
7+ < meta name ="description " content ="CoStrict 是一款免费开源的AI辅助编程工具,支持企业私有化部署,是企业严肃编程的最佳选择。 ">
78 < title > CoStrict</ title >
89 </ head >
910 < body >
Original file line number Diff line number Diff line change 11server {
22 listen 80 ;
33 proxy_set_header Host $host ;
4+
5+ # 1. 定义全局根目录 (确保 index.html 在这个目录下)
46 root /usr/share/nginx/html;
57 index index .html index .htm;
68
7- # 处理所有路径,支持前端路由
9+ # 2. 将原来的 location /costrict/ 改为 location /
10+ # 这样 /home, /login 等所有路由都会进入这里
811 location / {
12+ # 3. 这里不需要 alias 了,直接用上面的全局 root 即可
13+
14+ # 4. 核心修复:找不到文件时,回退到 /index.html
915 try_files $uri $uri / /index .html;
1016 }
1117
12- # 保留原有的costrict路径配置(如果需要)
13- location /costrict/ {
14- alias /usr/share/nginx/html/;
15- if ( -d $request_filename ) {
16- rewrite [^/]$ $scheme ://$http_host$uri / permanent;
17- }
18- try_files $uri $uri / /costrict/index .html;
19- }
18+ # 如果你确实需要保留 /costrict/ 这个特定前缀的访问逻辑,
19+ # 可以保留原有的 block,但必须加上上面的 location / 来处理普通页面路由。
2020
21+ # --- 以下保持不变 ---
2122 error_page 500 502 503 504 /50x .html;
2223 location = /50x .html {
2324 root /usr/share/nginx/html;
@@ -31,6 +32,5 @@ server {
3132 gzip_buffers 16 8k ;
3233 gzip_http_version 1.1;
3334 gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
34-
3535 gzip_disable "MSIE [1-6]\. (?!.*SV1)" ;
3636}
You can’t perform that action at this time.
0 commit comments