Two ways to reverse Google (image) -- nginx reverse generation and nginx extension - Mrxn's Blog
«

Two ways to reverse Google (image) -- nginx reverse generation and nginx extension

Time: 2017-9-24 07:38     Author: admin      Classification: Linux


The reason for writing this article is to see my blog friend Secret, who wrote an article:

Google Image Station for Building Wheels It reminds me of the Nginx extended image Google, which I struggled with before. It is more efficient than this. It also supports advanced configuration and multi-level cooperation to form a cluster like function. Today, I struggled again, so I write the process for the convenience of people who need it later

Statement: Please use the search engine reasonably within the scope permitted by law. This article is only a technical note and bears no responsibility


  1. update library
  2. apt - get update
  3.  
  4. #Install gcc&git
  5. apt - get install build - essential git gcc g ++ make - y
  6.  
  7. #Nginx official website: http://nginx.org/en/download.html
  8. wget " http://nginx.org/download/nginx-1.8.1.tar.gz "
  9.  
  10. #Pcre official website: http://www.pcre.org/
  11. wget " ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz "
  12.  
  13. #The official website of opessl: https://www.openssl.org/
  14. wget " https://www.openssl.org/source/openssl-1.0.1t.tar.gz "
  15.  
  16. #Zlib official website: http://www.zlib.net/
  17. wget " http://zlib.net/zlib-1.2.8.tar.gz "
  18.  
  19. #Download this extension
  20. git clone https : //github.com/cuber/ngx_http_google_filter_module
  21.  
  22. #Download the substitutions extension
  23. git clone https : //github.com/yaoweibin/ngx_http_substitutions_filter_module
  24.  
  25. #Decompress
  26. tar xzvf nginx - one point eight . 1.tar . gz && tar xzvf pcre - eight point three nine . tar . gz && tar xzvf openssl - one . 1t . tar . gz && tar xzvf zlib - one point two . 8.tar . gz
  27.  
  28. #Enter nginx source code directory
  29. cd nginx - one point eight . one
  30.  
  31. #Create nginx installation directory
  32. mkdir / usr / local / nginx - one point eight . one

Compiling nginx and its extensions

  1. #Set Compilation Options
  2. ./ configure \
  3. -- prefix = /usr/ local / nginx - one point eight . one \
  4. -- with - pcre =../ pcre - eight point three nine \
  5. -- with - openssl =../ openssl - one . 1t \
  6. -- with - zlib =../ zlib - one point two . eight \
  7. -- with - http_ssl_module \
  8. -- add - module =../ ngx_http_google_filter_module \
  9. -- add - module =../ ngx_http_substitutions_filter_module
  10.  
  11. #Compilation, installation
  12. #If the extension reports an error, please issue it to
  13. # https://github.com/cuber/ngx_http_google_filter_module/issues
  14. make
  15. make install

Finally, start nginx, access your server IP or resolve to the above domain name, and you can see whether nginx is installed

The github address of the ngx_http_google_filter_module project (he also has instructions there, but it is in English. If you can understand it, you can read the original text directly):

https://github.com/cuber/ngx_http_google_filter_module


Let's talk about the configuration of nginx:

  1. Simple stand-alone configuration of https does not support http reverse generation anymore
  1. server {
  2. server_name <Your domain name>;
  3. listen four hundred and forty-three ;
  4.  
  5. ssl on ;
  6. ssl_certificate <Your certificate>;
  7. ssl_certificate_key <Your private key>;
  8.  
  9. resolver eight point eight . eight point eight ;
  10. location / {
  11. google on ;
  12. }
  13. }
  1. Advanced configuration: configure multiple servers to alleviate concurrency and the frequency of verification codes

Google_scholar depends on Google, so google_scholar cannot be used independently Since Google Academic has recently upgraded to use the https protocol, and ncr already supports it, it is no longer necessary to specify Google Academic's tld

  1. location / {
  2. google on ;
  3. google_scholar on ;
  4. #Set to German, the default language is simplified Chinese
  5. google_language "de" ;
  6. }

Upstreaming

Upstream reduces the overhead of domain name resolution once, and by configuring Google IP with multiple network segments, it can reduce the probability of being detected by Google robot identification program (pop-up verification code) to a certain extent The upstream parameter should be placed in http {} (that is, outside the server {} configuration). Note that this parameter is only valid when you add an SSL certificate that is https, otherwise an error will be reported! It's easy to find the Google IP of this parameter. Ping www.google.com on your VPS and add or subtract 1 from the last digit of the IP.

 upstream  www.google.com { server 173.194.38.1:443; server 173.194.38.2:443; server 173.194.38.3:443; server 173.194.38.4:443; }

Proxy Protocol -- proxy protection

By default, the proxy will use https to communicate with the back-end server. You can use google_ssl_off to force some domain names to fall back to the http protocol. This is useful if you want to proxy some domains through another gateway without an ssl certificate.

 #
 # eg.
 # i want to proxy the domain 'www.google.com' like this
 # vps(hk) -> vps(us) -> google
 #

 #
 # configuration of vps(hk)
 #
 server { # ...
   location  / { google on; google_ssl_off  "www.google.com" ; } # ... } upstream  www.google.com { server < ip of vps(us) >:80; } #
 # configuration of vps(us)
 #
 server { listen  eighty ; server_name www.google.com; # ...
   location  / { proxy_pass https://www.google.com ; } # ... }

All these configurations are configured on a brand new machine. If you have already configured nginx, it is also easy. You just need to add extensions and dynamically compile them. After compiling, remember not to make install, just make compilation and then overwrite

./configure \
--prefix=/usr/local/nginx \
--user=www \
--group=www \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_gzip_static_module \
.......
--add-module=/data/software/ngx_http_google_filter_module \
--add-module=/data/software/ngx_http_substitutions_filter_module

Note: You need to execute this under the source package folder of nginx/ The configure command. Before using the command, first use nginx V to view the nginx version and download the source code package of the same version. When adding an extension, pay attention to the path. When it is best to copy, first stop nginx. At the same time, just in case, first copy a copy of nginx before overwriting. Reference materials are as follows:

http://imshusheng.com/linux/173.html

http://www.ttlsa.com/nginx/how-to-install-nginx-third-modules/

http://coolnull.com/4245.html

That's it. See you next time.) Finally, welcome to my Google image: gg.mrxn.net

label: google nginx compile agent

copyright: Mrxn's Blog
Article Title: Two ways to reverse Google (image) -- nginx reverse generation and nginx extension
Article link: https://mrxn.net/Linux/nginx_http_google_filter.html
All articles on this website are original, and please do not use them for any commercial purpose without authorization

Scan QR code and read on mobile phone

Recommended reading:

Comments:
 avatar
Secret 2017-09-25 09:17
The verification code is really a headache. It is almost over if the ladder is not hung.
 commentator
Mrxn 2017-09-28 13:49
@Secret: So it's the most convenient to use nginx extension in a small range
 avatar
Li Ming 2017-09-24 10:16
A professional article
 commentator
Mrxn 2017-09-24 12:46
@Li Ming: unprofessional haha, just write down your own process as a note