美文网首页
从零开始用nginx反向代理搭建google镜像

从零开始用nginx反向代理搭建google镜像

作者: Mr_dreamer | 来源:发表于2019-10-05 17:16 被阅读0次

本文假设你是一个全新的服务器,且IP没有被墙,如果你本身已经装好了服务器,可直接配置反向代理

  1. 首先你需要有一个境外的VPS,很容易搞到
  2. 下载必要环境
yum install -y gcc gcc-c++ git make
wget "http://nginx.org/download/nginx-1.7.8.tar.gz"
wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz"
wget "https://www.openssl.org/source/openssl-1.0.1j.tar.gz"
wget "https://www.openssl.org/source/openssl-1.0.1j.tar.gz"
wget "http://zlib.net/zlib-1.2.11.tar.gz"
git clone https://github.com/cuber/ngx_http_google_filter_module
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module

解压

tar xzvf nginx-1.7.8.tar.gz 
tar xzvf pcre-8.38.tar.gz 
tar xzvf openssl-1.0.1j.tar.gz 
tar xzvf zlib-1.2.11.tar.gz
  1. 编译安装
cd nginx-1.7.8
./configure --prefix=/usr/www/server/nginx-1.7.8 --with-pcre=../pcre-8.38 --with-openssl=../openssl-1.0.1j --with-zlib=../zlib-1.2.11 --with-http_ssl_module --add-module=../ngx_http_google_filter_module --add-module=../ngx_http_substitutions_filter_module
make && make install
  1. 配置nginx
/usr/www/server/nginx-1.7.8/sbin/nginx -t
vi /usr/www/server/nginx-1.7.8/conf/nginx.conf
server {
    listen       80;
    server_name  121.xxx.xxx.xxx; #此处换成该vps的外网ip
     location / {
        proxy_pass https://www.google.com;
        proxy_connect_timeout 120;
        proxy_read_timeout 600;
        proxy_send_timeout 600;
        send_timeout 600;
        proxy_redirect    off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        google on;
        google_language "zh-CN";
       }
  }
  1. 启动nginx
/usr/www/server/nginx-1.7.8/sbin/nginx -c /usr/www/server/nginx-1.7.8/conf/nginx.conf
  1. 使用IP访问一下试试吧

相关文章

  • 从零开始用nginx反向代理搭建google镜像

    本文假设你是一个全新的服务器,且IP没有被墙,如果你本身已经装好了服务器,可直接配置反向代理 首先你需要有一个境外...

  • ubuntu+docker搭建nginx反向代理

    nginx在我们的工作中是常用的反向代理服务,今天叫大家在ubuntu上使用docker镜像搭建nginx反向代理...

  • 借助Nginx搭建反向代理服务器

    借助Nginx搭建反向代理服务器 【大型网站技术实践】初级篇:借助Nginx搭建反向代理服务器 一、反向代理:We...

  • 第十九周作业

    1、搭建Tomcat集群,并通过nginx反向代理访问 反向代理示意图 测试环境: Nginx: 172.16.1...

  • Nginx反向代理配置与proxy_cache设置

    使用Nginx反向代理与proxy_cache缓存搭建CDN服务器的配置方法linux下通过Nginx反向代理和p...

  • 第二十周

    1、搭建Tomcat集群,并通过nginx反向代理访问 测试环境: Nginx: 172.16.100.151 T...

  • docker

    docker镜像目录 导出镜像 写时复制 docker镜像服务 nginx反向代理增加安全性https://git...

  • Nginx负载均衡机制

    Nginx(反向代理服务器) 正向代理 场景:在国内是无法正常使用google.com。如果想要访问google....

  • 论如何用Python实现反向代理1024

    现在实现反向代理主要都是使用Nginx,google一下用Python实现的版本,多数都是靠Flask+reque...

  • nginx 反向代理google

    利用nginx反向代理做一个谷歌镜像,实现谷歌访问。准备:一个可以解析的域名。一台可以访问goole的服务器,并配...

网友评论

      本文标题:从零开始用nginx反向代理搭建google镜像

      本文链接:https://www.haomeiwen.com/subject/ejxmuctx.html