current position:Home>How to configure Google reverse proxy on nginx server

How to configure Google reverse proxy on nginx server

2022-04-29 19:26:24Billion cloud speed

stay Nginx How to configure the server Google Reverse proxy

This article mainly introduces “ stay Nginx The server How to configure Google Reverse proxy ” Knowledge about , Xiaobian shows you the operation process through practical cases , The operation method is simple and fast , Practical , Hope this article “ stay Nginx How to configure the server Google Reverse proxy ” The article can help you solve problems .

One 、 Direct reverse proxy , It uses 7ghost Source code building , The advantage is simple and easy to use , The disadvantage is that it is easy to be shielded , Can't search for sensitive words .

Two 、 Use ssl Encrypted reverse proxy , The advantage is safety 、 Not easily shielded , The disadvantage is that it is relatively technical , There are many places to toss .

Now let's briefly talk about the setting process of the second method .

step1: You need to have one linux Overseas vps.

step2:nginx The establishment of the environment ( For convenience , Used in the tutorial amh One click package for environment construction , Of course, you use Junge one button bag or pure nginx Environmental Science # That is, only install nginx, No need to install php、sql What? # It's all right .)

step3: Install well amh after , land amh backstage ( The default address is your vps ip Address :8888), Click module extension —— Download module —— Search for “ssl”, Click to download .

 stay Nginx How to configure the server Google Reverse proxy

Okay , Now our ssl The module has been installed .
Now click virtual host , Fill in the domain name information , Click on ssl To configure , To configure ssl Related information .

 stay Nginx How to configure the server Google Reverse proxy

And then vps In the implementation of vim /usr/local/nginx/conf/vhost/ Your domain name .conf ( Other environments are subject to your environment ,amh Of conf Here, )
New code ( First, put your domain name .conf Empty all this file and then copy and paste the following code ), Then save to exit , restart nginx that will do .( The code needs to be changed according to the actual situation , Here in the form of complete code , The last part of the code is to let you access http Jump to 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;}

It's all done here .

ps: About ssl encryption
ssl The full name is security socket layer, If the website uses ssl encryption ,gfш You can't seal the domain name , Because during transmission url It's also encrypted ,gfш incapable of action . however gfш Yes, it can be sealed ip Of 443 Port of , But in that case, it can still be replaced ip To avoid being by the wall .

gfш The blockade google Of ssl Encrypted search , The principle is shielding google Appoint ip Of 443 port . Because of the establishment of https The first step in connecting is to request google Send a certificate : Send a http Packet to google Of ip Address , It says 443 port ,gfш Take a look , seal !

443 A port is a web browsing port , Mainly for https service , It's another way to provide encryption and transmission through a secure port http. In some websites with high security requirements , Such as banks 、 negotiable securities 、 Shopping, etc , All use https service , In this way, the information exchanged on these websites cannot be seen by others , Ensure the security of the transaction . The address of the web page is in https:// Start , Instead of the usual http://.

ssl certificate Need to buy , There are many cheap online ssl certificate , Probably 10 Dollars a year , This is one. .com The annual fee of the domain name is about the same . And in fact , You can also find free ssl certificate , for example startssl.com Free certificate provided . In terms of effectiveness , Cheap certificates are certainly a little worse than certificates issued by large institutions , But almost all mainstream browsers accept these certificates .

Site use ssl Encryption is not very friendly to search engines , Baidu basically does not include https Website ( Except for some big stations ), But it has no impact on Google .

About “ stay Nginx How to configure the server Google Reverse proxy ” That's all for , Thanks for reading . If you want to know more about the industry , You can pay attention to the Yisu cloud industry information channel , Xiaobian will update different knowledge points for you every day .

copyright notice
author[Billion cloud speed],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291744571001.html

Random recommended