自建谷歌鏡像


前言

當本站谷歌鏡像都無法訪問時,或無法忍受界面上的廣告時(廣告維持本站的服務器費用:>),那么搭建一個自己的鏡像就很有必要,本文以反向代理谷歌為示例,大家也可以嘗試反向代理學術,油管,推特等。


 

搭建所需

1.一台沒被牆的虛擬服務器(vps)
服務器推薦:vultr

2.服務器連接工具( XShell、PuTTY等)
工具下載:提取碼:yzd5
所需依賴包

1.nginx

2.pcre 正則

3.ngx_http_proxy_module 反向代理

4.ngx_http_substitutions_filter_module 多重替換

 


 

環境部署

本教程在centos6系統下進行

-->下載 pcre

 
        
wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz"

-->下載 openssl

 
        
wget "https://www.openssl.org/source/openssl-1.0.1j.tar.gz"

-->下載 zlib

 
        
wget "http://zlib.net/zlib-1.2.8.tar.gz"

-->下載 filter擴展

 
        
1 git clone https://github.com/cuber/ngx_http_google_filter_module
2 git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module

-->解壓縮

 
        
1 tar xzvf nginx-1.7.8.tar.gz
2 tar xzvf pcre-8.38.tar.gz
3 tar xzvf openssl-1.0.1j.tar.gz
4 tar xzvf zlib-1.2.8.tar.gz

-->設置編譯選項

 
        
cd nginx-1.7.8
./configure \
  --prefix=/opt/nginx-1.7.8 \
  --with-pcre=../pcre-8.38 \
  --with-openssl=../openssl-1.0.1j \
  --with-zlib=../zlib-1.2.8 \
  --with-http_ssl_module \
  --add-module=../ngx_http_google_filter_module \
  --add-module=../ngx_http_substitutions_filter_module

-->編譯 安裝

 
        
make
sudo make install

-->修改配置方式

 
        
sudo /opt/nginx-1.7.8/sbin/nginx

vi /opt/nginx-1.7.8/conf/nginx.conf

-->配置一(可選)只修改<你的域名或ip>即可,沒有域名可以使用vps的ip地址。

 server { server_name <你的域名或ip>; listen 80; resolver 8.8.8.8; location / { google on; } } 

-->配置二(可選)ssl證書提高了鏡像的穩定性。

server {
  server_name <你的域名或ip>;
  listen 443;

  ssl on;
  ssl_certificate <你的證書>;
  ssl_certificate_key <你的私鑰>;

  resolver 8.8.8.8;
  location / {
    google on;
  }
}

-->使用Esc+:wq保存並退出vim編輯器
-->重啟nginx使反代生效

 
        
sudo /opt/nginx-1.7.8/sbin/nginx -s reload

至此你就搭建好了屬於你的私人谷歌鏡像http://ip 即可訪問你的谷歌鏡像

 


 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM