#PROXY-START/

location ^~ /
{
    proxy_pass https://hostloc.com;
    proxy_set_header Referer "https://hostloc.com/";
    proxy_set_header Host hostloc.com;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;

    add_header X-Cache $upstream_cache_status;

    #Set Nginx Cache

    proxy_set_header Accept-Encoding "";
    add_header Access-Control-Allow-Origin *;
    sub_filter_types text/css text/xml text/javascript application/javascript application/json;
    sub_filter '"//' '"https://';
        sub_filter "hostloc.com" "你的域";
        sub_filter "www.hostloc.com" "你的域";
        sub_filter "主机" "煮鸡";
    sub_filter "用户组: 论坛元老" "用户组: 管理员";
    sub_filter_once off;
   
   
    set $static_fileCz06CWLw 0;
    if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
    {
            set $static_fileCz06CWLw 1;
            expires 12h;
        }
    if ( $static_fileCz06CWLw = 0 )
    {
    add_header Cache-Control no-cache;
    }
}

#PROXY-END/

把以上配置放到nginx的配置文件中重启后即可。

最后修改:2022 年 11 月 25 日
如果觉得我的文章对你有用,请随意赞赏