写一个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;
            }
        }
    }

}

 

相关文章:

  • 2021-11-23
  • 2021-12-05
  • 2021-11-18
  • 2021-12-05
  • 2021-12-05
  • 2022-01-08
  • 2021-12-07
  • 2021-07-30
猜你喜欢
  • 2021-08-16
  • 2021-10-16
  • 2021-11-08
  • 2022-01-01
  • 2021-11-06
  • 2021-10-12
  • 2021-12-25
  • 2021-12-02
相关资源
相似解决方案