##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#

server {
    listen 4443 ssl http2;
    listen [::]:4443 ssl http2;

    ssl_certificate /etc/letsencrypt/live/gcdn.jp.pmol.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/gcdn.jp.pmol.me/privkey.pem;
    ssl_session_cache shared:SSL:20m;
    ssl_session_timeout 60m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    root /var/www/null;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name gcdn.jp.pmol.me;

    location / {
        proxy_redirect off;
        proxy_cookie_domain google.com gcdn.jp.pmol.me; 
        proxy_pass https://www.google.com;
        proxy_connect_timeout 60s;
        proxy_read_timeout 5400s;
        proxy_send_timeout 5400s;
    
        proxy_set_header Host "www.google.com";
        proxy_set_header User-Agent $http_user_agent;
        proxy_set_header Referer https://www.google.com;
        proxy_set_header Accept-Encoding "";
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Accept-Language "zh-CN";
        proxy_set_header Cookie "PREF=ID=047808f19f6de346:U=0f62f33dd8549d11:FF=2:LD=en-US:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2W1IQ-Maw";
        
        subs_filter 'www.gstatic.com' 'gcdn.jp.pmol.me:4443/wwwgstatic' g;
                subs_filter 'www.google.com/recaptcha' 'gcdn.jp.pmol.me:4443/recaptcha' g;

        subs_filter https://www.google.co.jp gcdn.jp.pmol.me g;
        subs_filter https://www.google.com gcdn.jp.pmol.me g;
        #subs_filter_types text/css text/xml text/javascript;

        sub_filter_once off; 
        break;
    }


    # reCaptcha reverse proxy
    location /recaptcha {
        default_type text/html;
        subs_filter_types text/css text/xml text/javascript;
        subs_filter 'www.gstatic.com' 'gcdn.jp.pmol.me:4443/wwwgstatic' g;
        proxy_set_header X-real-ip $remote_addr;
        proxy_pass https://www.google.com/recaptcha;
        proxy_set_header Accept-Encoding ""; #see [3]
        proxy_set_header User-Agent $http_user_agent;
        break;
    }
    location /wwwgstatic {
        subs_filter_types text/css text/xml text/javascript;
        subs_filter 'www.gstatic.com' 'gcdn.jp.pmol.me:4443/wwwgstatic' g;
        subs_filter 'www.google.com/recaptcha' 'gcdn.jp.pmol.me:4443/recaptcha' g;
        subs_filter 'ssl.gstatic.com' 'gcdn.jp.pmol.me:4443/sslgstatic' g;
        proxy_set_header X-real-ip $remote_addr;
        proxy_pass https://www.gstatic.com/;
        proxy_set_header Accept-Encoding "";
        proxy_set_header User-Agent $http_user_agent;
        break;
    }
    location /sslgstatic {
        subs_filter_types text/css text/xml text/javascript;
        subs_filter 'www.gstatic.com' 'gcdn.jp.pmol.me:4443/wwwgstatic' g;
        subs_filter 'www.google.com/recaptcha' 'gcdn.jp.pmol.me:4443/recaptcha' g;
        proxy_set_header X-real-ip $remote_addr;
        proxy_pass https://ssl.gstatic.com/;
        proxy_set_header Accept-Encoding "";
        proxy_set_header User-Agent $http_user_agent;
        break;
    }


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    
    location ~ /\.ht {
        deny all;
    }
}

扫描二维码,在手机上阅读!
*本站文章保留所有权利,如需转载请联系me#nicho1as.wang