mirror of
https://github.com/acepanel/acepanel.github.io.git
synced 2026-02-04 07:57:17 +08:00
feat: 更新伪静态模板
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
```nginx
|
||||
location ^~ /
|
||||
{
|
||||
proxy_pass http://xxx.xxx;
|
||||
set $empty ""; # 通过变量解决Nginx不会自动更新域名解析的问题
|
||||
proxy_pass http://xxx.xxx$empty;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -17,22 +18,26 @@ location ^~ /
|
||||
proxy_ssl_session_reuse off;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_protocols TLSv1.2 TLSv1.3;
|
||||
proxy_http_version 1.1; # 可选,如果后端支持 HTTP 1.0 可去除
|
||||
proxy_http_version 1.1;
|
||||
# 可选,自定义 DNS 服务器
|
||||
resolver 8.8.8.8 ipv6=off;
|
||||
resolver_timeout 10s;
|
||||
|
||||
# 可选,无缓冲区(SSE等需要)
|
||||
# 下方两个可选配置项只能保留其中一个
|
||||
|
||||
# 可选,无缓冲区(AI等SSE应用需要)
|
||||
proxy_buffering off;
|
||||
proxy_max_temp_file_size 0;
|
||||
|
||||
# 可选,缓存响应(类似CDN)
|
||||
proxy_ignore_headers Set-Cookie Cache-Control expires; # 如果不想缓存动态请求,请删除此行
|
||||
# proxy_ignore_headers Set-Cookie Cache-Control Expires; # 如果需要缓存动态请求,请取消注释此行
|
||||
proxy_cache cache_one;
|
||||
proxy_cache_key $host$uri$is_args$args;
|
||||
proxy_cache_valid 200 304 301 302 1d; # 设置缓存时间 1d 表示一天
|
||||
proxy_cache_valid 200 304 301 302 1d; # 设置缓存时间 1d 表示一天,单位可选 m-分钟 h-小时 d-天
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
}
|
||||
```
|
||||
|
||||
以上规则亦可通过选择 proxy 伪静态预设直接使用,无需来回复制。
|
||||
|
||||
注意:如果设置反向代理后出现 CSS/JS 无法正常加载的问题,请移除站点主配置文件中的**静态资源**缓存部分。
|
||||
|
||||
Reference in New Issue
Block a user