Published 10 months ago
Published 10 months ago
Naldela Teleyal
Updated a year ago
0
Maybe a small asset cache to speed up some transfers, like npm does?
1proxy_cache_path /usr/share/nginx/public-cache levels=1:2 keys_zone=public-cache:30m max_size=192m;
1 location ~* ^.*\.(css|js|jpe?g|gif|png|webp|woff|eot|ttf|svg|ico|css\.map|js\.map)$ { 2 if_modified_since off; 3 proxy_buffering on; 4 5 # use the public cache 6 proxy_cache public-cache; 7 proxy_cache_key $host$request_uri; 8 proxy_cache_min_uses 1; 9 10 # ignore these headers for media 11 proxy_ignore_headers Set-Cookie Cache-Control Expires X-Accel-Expires; 12 13 # cache 200s and also 404s (not ideal but there are a few 404 images for some reason) 14 proxy_cache_valid any 30m; 15 proxy_cache_valid 404 1m; 16 17 # strip this header to avoid If-Modified-Since requests 18 proxy_hide_header Last-Modified; 19 proxy_hide_header Cache-Control; 20 proxy_hide_header Vary; 21 22 proxy_cache_bypass 0; 23 proxy_no_cache 0; 24 25 proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504 http_404; 26 proxy_connect_timeout 5s; 27 proxy_read_timeout 45s; 28 29 expires @30m; 30 31 proxy_set_header Accept-Encoding ''; 32 proxy_set_header Referer $http_referer; 33 proxy_set_header Host $host; 34 proxy_set_header Cookie $http_cookie; 35 proxy_set_header Upgrade $http_upgrade; 36 proxy_set_header Connection $connection_upgrade_keepalive; 37 38 proxy_set_header X-Real-IP $remote_addr; 39 proxy_set_header X-Forwarded-Host $host; 40 proxy_set_header X-Forwarded-Server $host; 41 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 42 43 add_header X-Cache-Status $upstream_cache_status; 44 proxy_pass ....; 45 }
Monster
Updated a year ago
0
We are planning to add the feature of customizing nginx configuration files recently, and you can write these configurations directly into it.
Christos Panagiotakis
Updated 8 days ago
This is the "Custom NGINX Config" I see in Application's Advance tab ?
Carrie-SafeLine
Updated 7 days ago
Yes!
Christos Panagiotakis
Updated 6 days ago
proxy_cache_path should be on "http {" directive if I am not mistaken. You allow the server only. You could include a custom file that could be edited under "http" for that, I don't know if I can edit (basically I can edit tengine's nginx.conf) but I don't know if it persists on updates/composer/down/up. Except if I am missing something here.
donglei li
Updated 6 days ago
Yes, the proxy_cache_path should be configured within the "http {" directive block. The WAF currently does not support modifications to the content of this directive block. If you forcibly modify it, the configuration will be overwritten when updating the site on the control panel.