Add these additional third-party extensions to nginx to speed up your web
Linux
-
OpenSSL 1.1.0, ALPN support, HTTP/2 support -
Nginx CT, transparent certificate improves the security of HTTPS website and browser support -
Ngx_PageSpeed, Google Home's website performance optimization tool -
Brotli, achieving higher compression ratio than Gzip -
Jemalloc, optimizing memory management
Download the required source code package:
wget https://github.com/grahamedgecombe/nginx-ct/archive/v1.3.2.tar.gz
tar xzf v1.3.2.tar.gz
git clone https://github.com/google/ngx_brotli.git
cd ngx_brotli
git submodule update --init
wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.12.34.3-stable.zip
unzip v1.12.34.3-stable.zip
cd ngx_pagespeed-1.12.34.3-stable/
wget https://dl.google.com/dl/page-speed/psol/1.12.34.2-x64.tar.gz
tar -xzvf 1.12.34.2-x64.tar.gz
--prefix=/usr/local/nginx --with-http_stub_status_module
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --add-module=/data/software/nginx-ct-1.3.2 --add-module=/data/software/ngx_brotli --add-module=/data/software/ngx_pagespeed-1.12.34.3-stable
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
service nginx stop
cp ./ objs/nginx /usr/local/nginx/sbin/
Two ways to reverse Google (image) -- nginx reverse generation and nginx extension
Linux
Statement: Please use the search engine reasonably within the scope permitted by law. This article is only a technical note and bears no responsibility
update library apt - get update #Install gcc&git apt - get install build - essential git gcc g ++ make - y #Nginx official website: http://nginx.org/en/download.html wget " http://nginx.org/download/nginx-1.8.1.tar.gz " #Pcre official website: http://www.pcre.org/ wget " ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz " #The official website of opessl: https://www.openssl.org/ wget " https://www.openssl.org/source/openssl-1.0.1t.tar.gz " #Zlib official website: http://www.zlib.net/ wget " http://zlib.net/zlib-1.2.8.tar.gz " #Download this extension git clone https : //github.com/cuber/ngx_http_google_filter_module #Download the substitutions extension git clone https : //github.com/yaoweibin/ngx_http_substitutions_filter_module #Decompress 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 #Enter nginx source code directory cd nginx - one point eight . one #Create nginx installation directory mkdir / usr / local / nginx - one point eight . one
Compiling nginx and its extensions
#Set Compilation Options ./ configure \ -- prefix = /usr/ local / nginx - one point eight . one \ -- with - pcre =../ pcre - eight point three nine \ -- with - openssl =../ openssl - one . 1t \ -- with - zlib =../ zlib - one point two . eight \ -- with - http_ssl_module \ -- add - module =../ ngx_http_google_filter_module \ -- add - module =../ ngx_http_substitutions_filter_module #Compilation, installation #If the extension reports an error, please issue it to # https://github.com/cuber/ngx_http_google_filter_module/issues make make install
Let's talk about the configuration of nginx:
-
Simple stand-alone configuration of https does not support http reverse generation anymore
server { server_name <Your domain name>; listen four hundred and forty-three ; ssl on ; ssl_certificate <Your certificate>; ssl_certificate_key <Your private key>; resolver eight point eight . eight point eight ; location / { google on ; } }
-
Advanced configuration: configure multiple servers to alleviate concurrency and the frequency of verification codes
location / { google on ; google_scholar on ; #Set to German, the default language is simplified Chinese google_language "de" ; }
Upstreaming
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
# # eg. # i want to proxy the domain 'www.google.com' like this # vps(hk) -> vps(us) -> google # # # configuration of vps(hk) # server { # ... location / { 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
error while loading shared libraries: libsodium.so.18: cannot open shared
Linux