IT运维笔记


nginx 配置 google代理

准备的东西

1.一个可以访问google的vps,推荐搬瓦工,120rmb/Y 2.一个垃圾域名(已经解析到该vps的ip),被封不心疼 3.nginx 4.ssl证书 ,可以使用腾讯免费一年的https://console.qcloud.com

easy模式,不需要ssl证书

tips: 听说有时候会被定向到google.com
server
{
    listen          80;
    server_name     example.com;  #你的域名
    location / {
        proxy_pass          http://www.google.com/;  #需要反代的域名
        proxy_redirect      off;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

ssl证书

    server {
        listen 80;
        server_name example.com www.example.com;
        location / {
            rewrite ^/(.*)$ https://example.com$1 permanent;
        }
    }
    server {
        listen       443 ssl http2 default_server;
        ssl on;

        server_name www.example.com;
        ssl_certificate 1_www.example.com_bundle.crt;
        ssl_certificate_key 2_www.example.com.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location / {
               proxy_redirect off;
               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_pass https://www.google.com;
               sub_filter  www.google.com www.example.com;
               sub_filter_once off;
        }
参考自: https://hack0nair.me/2014-10-25-how-to-setup-reverse-proxy-by-nginx/ https://blog.kings-way.info/?p=689 https://www.v2ex.com/t/202435 https://www.qcloud.com/document/product/400/4143#2.-nginx-.E8.AF.81.E4.B9.A6.E9.83.A8.E7.BD.B2 配置nginx https://mos.meituan.com/library/21/initial-setup-with-centos/ https://mos.meituan.com/library/18/how-to-install-lnmp-on-centos7/ https://gist.github.com/ifels/c8cfdfe249e27ffa9ba1 配置 ftp http://pcvc.net/blog/2015/08/09/centos-7-installation-configuration-do-vsftpd-ftp-service/