perf: nginx security headers + SPA fallback + robots.txt + sitemap.xml + /ai-chat proxy
- 添加 Security Headers (X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, Referrer-Policy) - 修复 SPA fallback (try_files $uri $uri/ /index.html) - /tools, /score, /calendar, /plan 不再 404 - 新增 /ai-chat location 代理到 Flask /chat (修复 plan.html 的 POST 请求) - 新增 robots.txt 和 sitemap.xml (SEO 优化) - 保留 nginx 配置文件备份 (gaokao.conf.panel)
This commit is contained in:
parent
1fd3b0e88b
commit
1ed0809338
|
|
@ -0,0 +1,49 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name zszs.site 192.144.179.11;
|
||||
|
||||
# Security Headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
location / {
|
||||
root /www/wwwroot/gaokao;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /ai-chat {
|
||||
proxy_pass http://127.0.0.1:8080/chat;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 150s;
|
||||
}
|
||||
|
||||
location /chat {
|
||||
proxy_pass http://127.0.0.1:8080/chat;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 150s;
|
||||
}
|
||||
|
||||
location /ai-tool-chat {
|
||||
proxy_pass http://127.0.0.1:8080/ai-tool-chat;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 150s;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8080/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 150s;
|
||||
}
|
||||
|
||||
location /health {
|
||||
proxy_pass http://127.0.0.1:8080/health;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
User-agent: *
|
||||
Allow: /
|
||||
Disallow: /api/
|
||||
Disallow: /gaokao_henan.db
|
||||
|
||||
Sitemap: http://192.144.179.11/sitemap.xml
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>http://192.144.179.11/</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/ai-chat</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/ai-tool.html</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/plan.html</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/school.html</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/major.html</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/qa.html</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.6</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://192.144.179.11/diag.html</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.6</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
Loading…
Reference in New Issue