時間:2023-06-22 01:15:01 | 來源:網站運營
時間:2023-06-22 01:15:01 來源:網站運營
centos 7.1下制作google鏡像站:參考鏈接: cuber/ngx_http_google_filter_moduleifconfig
查看本機外網ip,記錄后備用:yum install -y gcc gcc-c++ git makewget "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_modulegit 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
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.11 --with-http_ssl_module --add-module=../ngx_http_google_filter_module --add-module=../ngx_http_substitutions_filter_module
makesudo make install
/opt/nginx-1.7.8/sbin/nginx -t
7.進入conf文件編輯:vi /opt/nginx-1.7.8/conf/nginx.conf
按a鍵可以進行編輯,坐下角會出現(xiàn)insert標志,這是linux基本的命令。按ESC后,輸入:wq是保存并退出,輸入:q!是不保存退出。server { listen 80; server_name www.abc.com;#此處換成該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"; } }
ESC后輸入保存并退出文件的命令:/opt/nginx-1.7.8/sbin/nginx -c /opt/nginx-1.7.8/conf/nginx.conf
如果此時nginx已經啟動,得重新加載一次/opt/nginx-1.7.8/sbin/nginx -s reload
至此在本地瀏覽器輸入vps的ip地址,已經可以訪問google了關鍵詞: