时间: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键可以进行编辑,坐下角会出现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了关键词: