1
liuyinltemp OP 贴一下配置
user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 128; multi_accept on; use epoll; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 60; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffer_size 64k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k; proxy_temp_path /etc/nginx/cache/temp; proxy_cache_path /etc/nginx/cache/path levels=1:2 keys_zone=cache_one:32m inactive=1d max_size=1g; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 5; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { listen 80; server_name bbb.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name bbb.com; ssl on; ssl_certificate cert/shss.crt; ssl_certificate_key cert/shss.key; ssl_session_timeout 8m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256::!MD5; ssl_prefer_server_ciphers on; } location / { sub_filter aaa.com bbb.com; proxy_pass http://aaa.com; proxy_http_version 1.1; proxy_redirect off; proxy_cache_key "$scheme://$host$request_uri"; proxy_cache cache_one; proxy_cache_valid 200 304 10m; proxy_cache_valid 301 1h; proxy_cache_valid any 10s; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Referer http://aaa.com; proxy_set_header Host $proxy_host; proxy_set_header Accept-Encoding ""; } } } |
2
linearsky 2018-04-21 22:55:12 +08:00
|
3
xiaoz 2018-04-22 00:16:40 +08:00 via Android
subsfilter 模块了解下
|
4
Love4Taylor 2018-04-22 00:28:09 +08:00 via Android 1
subs_filter 批量替换吧
|
5
Loyalsoldier 2018-04-22 09:45:43 +08:00
|
6
liuyinltemp OP 图床<img src="http://***.jpg" ,这个图床的地址不是固定的,看发帖人选择,有通用的吗?
|
7
superhan 2018-04-22 19:52:17 +08:00 via Android
@Love4Taylor 这是啥软件
|
8
Love4Taylor 2018-04-22 19:56:39 +08:00
|
9
Loyalsoldier 2018-04-22 19:59:24 +08:00
@Love4Taylor #8 subs_filter 好像是不支持 HTTPS 协议的啊
|
10
Love4Taylor 2018-04-22 20:05:27 +08:00 1
@Loyalsoldier #9 这俩没关系.... 倒是反代的时候关 gzip 倒是真的... 不然没法替换
|
11
liuyinltemp OP 关闭 gzip,问题怎么写代码?谢谢!小白,虽然学过计算机,现已转行。
|
12
Love4Taylor 2018-04-22 20:26:10 +08:00
你需要
1. aaa.com 的反代并且使用 subs_filter 的正则来替换你需要替换的 img 标签 2. 图床的反代 关 gzip 就是 proxy_set_header Accept-Encoding " "; |
13
liuyinltemp OP @Love4Taylor 图床不是固定的,看用户用那个?怎么处理。我想将<img src=对应的图片缓存下来变成现在网站的相对地址,然后替换,不知道可不可行?
|