How to configure Google reverse proxy on Nginx server
一、直接反向代理,使用的是7ghost源码搭建,优点是简单容易上手,缺点是容易被屏蔽,不能搜索敏感词。
二、使用ssl加密反向代理,优点是安全、不易被屏蔽,缺点是技术性相对较强,需要折腾的地方也多。
现在主要简单说下第二种方法的设置过程。
step1:你得需要有一台linux的海外vps。
step2:nginx环境的建立(为了方便,教程中就用amh一键包进行环境构建,当然你用军哥一键包或纯nginx环境#也就是只安装nginx,不用安装php、sql啥的#都是可以的。)
step3:安装好amh后,登陆amh后台(默认地址为你的vps ip地址:8888),点击模块扩展——下载模块——搜索“ssl”,点击下载。
好了,现在咱们的ssl模块已经安装完成了。
现在点击虚拟主机,填写好域名信息,点击ssl配置,配置ssl相关信息。
接着在vps中执行vim /usr/local/nginx/conf/vhost/你的域名.conf (其他环境的以你的环境为准,amh的conf在此处)
新增代码(要先把你的域名.conf这个文件全部清空再复制粘贴如下代码),然后保存退出,重启nginx即可。(代码根据实际情况需要做一些改动,这里以完整代码的形式给出,代码最后一部分是让访问http跳转到https)
server { listen 443; server_name guance.com; ssl on; ssl_certificate /usr/local/nginx/conf/ssl/www.guance.com.crt; ssl_certificate_key /usr/local/nginx/conf/ssl/www.guance.com.pem; ssl_protocols sslv3 tlsv1; ssl_ciphers all:-adh:+high:+medium:-low:-sslv2:-exp; location / { proxy_redirect off; proxy_pass https://www.google.co.jp/; proxy_redirect http://www.google.com/ /; proxy_cookie_domain google.com guance.com; proxy_set_header accept-encoding ""; proxy_set_header user-agent $http_user_agent; proxy_set_header accept-language "zh-cn"; proxy_set_header cookie "pref=id=047808f19f6de346:u=0f62f33dd8549d11:ff=2:ld=zh-cn:nw=1:tm=1325338577:lm=1332142444:gm=1:sg=2:s=re0syjh2w1iq-maw"; } } server { listen 80; server_name guance.com; rewrite ^(.*) https://guance.com$1 permanent; } server { listen 80; server_name www.guance.com; rewrite ^(.*) https://guance.com$1 permanent; } server { listen www.guance.com:80; server_name guance.com; rewrite ^(.*)$ https://$host$1 permanent; }
到这里已经全部完成。
ps:关于ssl加密
ssl全称是security socket layer,如果网站使用了ssl加密,gfш就无法封域名了,因为传输过程中url也是加密的,gfш无能为力。但是gfш是可以封ip的443端口的,不过那样的话也还是可以通过更换ip来达到避免被墙的目的。
gfш封锁google的ssl加密搜索,原理就是屏蔽google指定ip的443端口。因为建立https连接的第一步是请求google发证书过来:发一个http数据包到google的ip地址,里面写着443端口,gfш一看,封!
443端口即网页浏览端口,主要是用于https服务,是提供加密和通过安全端口传输的另一种http。在一些对安全性要求较高的网站,比如银行、证券、购物等,都采用https服务,这样在这些网站上的交换信息其他人都无法看到,保证了交易的安全性。网页的地址以https://开始,而不是常见的http://。
ssl证书需要购买,网上有很多便宜的ssl证书,大概10美元一年,这和一个.com域名的年费差不多。而且事实上,还能找到免费的ssl证书,例如startssl.com提供的免费证书。在效力上,便宜的证书当然会比大机构颁发的证书差一点,但是几乎所有的主流浏览器都接受这些证书。
网站使用ssl加密对搜索引擎不太友好,百度基本不收录https网站(一些大站除外),但是对谷歌是没有影响的。
The above is the detailed content of How to configure Google reverse proxy on Nginx server. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

The methods that can query the Nginx version are: use the nginx -v command; view the version directive in the nginx.conf file; open the Nginx error page and view the page title.

How to configure an Nginx domain name on a cloud server: Create an A record pointing to the public IP address of the cloud server. Add virtual host blocks in the Nginx configuration file, specifying the listening port, domain name, and website root directory. Restart Nginx to apply the changes. Access the domain name test configuration. Other notes: Install the SSL certificate to enable HTTPS, ensure that the firewall allows port 80 traffic, and wait for DNS resolution to take effect.

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP
