指引网

当前位置: 主页 > 服务器 > Nginx >

Nginx Google 代理模块Upstreaming配置详解

来源:网络 作者:佚名 点击: 时间:2017-06-13 21:35
[摘要]  下面我们来看关于Nginx Google 代理模块Upstreaming配置了,这个代理模块对于各位还是有帮助了,今天我们就一起来看看吧。

系统版本:

[root@Centos6 /]# cat /etc/redhat-release
CentOS release 6.6 (Final)

获取IP:

[root@Centos6 /]# dig www.google.com.hk +short
172.217.1.35
[root@Centos6 /]# dig www.google.com.hk +short
216.58.216.131
[root@Centos6 /]# dig www.google.com.hk +short
216.58.216.67
[root@hk /]# dig www.google.com.hk +short

拓展版本:

[root@Centos6 conf]# cat ./nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    upstream www.google.com {
    server 216.58.193.67:443;
    server 216.58.193.68:443;
    server 216.58.199.99:443;
    server 216.58.216.131:443;
    server 216.58.193.163:443;
    server 216.58.219.3:443;
    server 216.58.216.3:443;
    server 172.217.1.36:443;
    server 172.217.1.35:443;
    server 173.194.38.211:443;
    server 173.194.72.199:443;
    server 173.194.38.212:443;
    server 173.194.38.210:443;
    server 173.194.38.208:443;
    server 64.233.187.199:443;
    server 64.233.189.199:443;
    server 74.125.203.199:443;
    server 74.125.23.199:443;
    }
    gzip   on;
    gzip_min_length   1k;
    gzip_buffers    4 16k;
    gzip_http_version   1.1;
    gzip_comp_level   9;
    gzip_types   text/plain application/javascript text/css application/xml;
    gzip_vary   on;
    server {
        listen       443;
        server_name  www.111cn.net;
        resolver 8.8.8.8;
        ssl on;
        ssl_certificate XXX.crt;
        ssl_certificate_key XXX.key;
        location / {
            proxy_pass         https://www.google.com;
            google on;
            google_scholar on;
            google_language "en";
            root   /web/site/google;
            index  index.php index.html index.htm;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_headers_hash_max_size 51200;
            proxy_headers_hash_bucket_size 6400;
        }
}
}

------分隔线----------------------------