系统相关
首页 > 系统相关> > 写一个nginx.conf方便用于下载某个网页的所有资源

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

}

 

标签:tmpfile,set,网页,rootDir,nginx,host,proxy,conf,pass
来源: https://www.cnblogs.com/xiangxisheng/p/14071746.html