Nginx
是否可以使用 Nginx 終止 SSL 並記憶體來自後端的 https 響應?
希望從 nginx 的後端服務終止 SSL 並作為 http 解除安裝到客戶端。記憶體性能和離線場景的所有響應。使用下面的設置我無法記憶體,缺少什麼?
events {} http { include mime.types; #PROXY proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache_sample:10m max_size=50m; proxy_cache_key "$scheme$request_method$host$request_uri:w"; add_header cache_sample $upstream_cache_status; server { listen 81; server_name _; ssl_verify_client off; location ~* { proxy_pass https://backend_service; proxy_set_header Host $http_host; proxy_set_header X_FORWARDED_PROTO https; proxy_ssl_certificate /backend_service.crt; proxy_ssl_certificate_key /backedn_service.key; proxy_ssl_ciphers HIGH:!aNULL:!MD5; proxy_ssl_verify off; } } }
應該是可以的,試試這樣的。我看到一些東西不見了,而且看起來有點奇怪,比如一行末尾的“:w”。
第一部分超出您的伺服器塊
fastcgi_cache_key "$scheme$request_method$host$request_uri"; # Determines in which cases a stale cached response can be used when an error occurs during # communication with the FastCGI server fastcgi_cache_use_stale error timeout invalid_header http_500; # Many websites send back inappropriate headers, so ignore them fastcgi_ignore_headers Cache-Control Expires Set-Cookie; # Caching. Putting the cache into /dev/shm keeps it in RAM, limited to 10MB, for one day. This is Centos, other distibutions are different. # You can move to disk if you like, or extend the caching time fastcgi_cache_path /dev/shm/hr_nginxcache levels=1:2 keys_zone=CACHE_NAME:10m inactive=1440m; #RAM
這靠近伺服器塊的頂部
set $skip_cache 0; # POST requests and urls with a query string should always go to PHP if ($request_method = POST) { set $skip_cache 1; } if ($query_string != "") { set $skip_cache 1; } # Don't cache uris containing the following segments. # for everyone. I've removed index.php as I want pages cached. if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|sitemap(_index)?.xml") { set $skip_cache 1; } # Don't use the cache for logged in users or recent commenters if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|code") { set $skip_cache 1; }
這在您的位置塊中
fastcgi_cache CACHE_NAME; fastcgi_cache_valid 200 1440m; add_header X-Cache $upstream_cache_status; fastcgi_cache_methods GET HEAD; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache;
您必須編輯部分以適合您的站點。