写一个nginx.conf方便用于下载某个网页的所有资源

写一个nginx.conf方便用于下载某个网页的所有资源

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server{
        listen 8811;
        listen [::]:8811;
        set $proxy_pass_schema "https";
        set $proxy_pass_host "这里改成你要下载网站的域名";
        set $proxy_pass "${proxy_pass_schema}://${proxy_pass_host}";
        resolver 114.114.114.114;
        index _index.html;
        set $rootDir "hosts/${proxy_pass_host}";
        root "${rootDir}";
        proxy_set_header Host $proxy_pass_host;
        proxy_set_header Accept-Encoding "";
        location /{
            set $tmpfile "${rootDir}${uri}";
            proxy_store $tmpfile;
            if (!-e $request_filename) {
                proxy_pass $proxy_pass;
            }
        }
        location ~ /$ {
            set $tmpfile "${rootDir}${uri}_index.html";
            proxy_store $tmpfile;
            if (!-e $tmpfile) {
                proxy_pass $proxy_pass;
            }
        }
    }

}

 

上一篇:MMKV使用


下一篇:pytest文档65-内置 request 读取项目的根目录 rootdir