标签:ber ngx clone mod 编辑 evel 下载 prot 环境变量
因为要做Google学术反向代理,正好nginx有个对应的模块,但版本不支持最新版nginx所以选择了旧版nginx 1.78版本,系统版本centos7。
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel git make
wget "http://nginx.org/download/nginx-1.7.8.tar.gz"
git clone https://github.com/cuber/ngx_http_google_filter_module
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
tar xzvf nginx-1.7.8.tar.gz cd nginx-1.7.8
./configure --prefix=/etc/nginx \--with-http_ssl_module \
--with-http_stub_status_module --add-module=/root/ngx_http_google_filter_module --add-module=/root/ngx_http_substitutions_filter_module
vim /etc/profile //编辑文件 export PATH=$PATH:/usr/sbin/nginx/sbin //添加该行 source ~/.bashrc //生效
nginx //启动 nginx -s stop //停止 nginx -s reload //重启
server { listen 443 ssl; server_name 域名; ssl_certificate /etc/nginx/ssl/xx.pro_chain.crt; ssl_certificate_key /etc/nginx/ssl/xx.pro_key.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; resolver 8.8.8.8; location / { subs_filter_types *; google on; google_scholar on; } }
该模块是将学术和搜索合并在一起的,通过两个域名实现url重写将学术绑定独立域名
server { listen 443 ssl; server_name xx.pro; #域名 ssl_certificate /etc/nginx/ssl/xx.pro_chain.crt; ssl_certificate_key /etc/nginx/ssl/xx.pro_key.key; location / { if ($request_uri ~* "/scholar\?"){ proxy_pass https://www.xx.pro/scholar?$args; break; } proxy_pass https://www.xx.pro/scholar/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
标签:ber ngx clone mod 编辑 evel 下载 prot 环境变量
原文地址:https://www.cnblogs.com/hlikex/p/12729246.html