root /home/odisgate.ru; index index.html; location ~* \.(js css png jpg jpeg gif ico svg…
- User
root /home/odisgate.ru; index index.html;
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf)$ { expires 365d; add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } location = /vcf { #limit_req zone=api_limit burst=1; root /home/odisgate.ru; index index.html; try_files $uri /vcf.html; } location / { proxy_pass https://odis-pro.tilda.ws/; proxy_set_header Host sklad-metallreck.ru; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_ssl_server_name on; Для улучшения производительности (опционально) proxy_cache_bypass $http_upgrade; } location = / { limit_except GET { deny all; } limit_req zone=api_limit burst=1; root /home/odisgate.ru; index index.html; try_files $uri /index.html; } error_page 404 /404.html; location = /404.html { root /home/www/error; }Хочу все закешировать по / на сутки у меня есть такое proxy_cache_path /tmp/nginx/fastcgi/stqr_cache levels=1:2 keys_zone=stqr_cache:10m max_size=64m inactive=30d use_temp_path=off;
- Assistant
- User
еще рааз я хочу запрос /vcf локально, а все остальное с прокси
root /home/odisgate.ru; index index.html; location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf)$ { expires 365d; add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } location = /vcf { #limit_req zone=api_limit burst=1; root /home/odisgate.ru; index index.html; try_files $uri /vcf.html; } location / { proxy_cache stqr_cache; proxy_cache_valid 200 302 1d; proxy_cache_valid 404 1m; proxy_cache_use_stale error timeout updating; proxy_cache_background_update on; proxy_pass https://odis-pro.tilda.ws/; proxy_set_header Host odis-pro.tilda.ws; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_ssl_server_name on; proxy_cache_bypass $http_upgrade; proxy_no_cache $http_cache_control; } #location = / { # limit_except GET { # deny all; # } # limit_req zone=api_limit burst=1; # root /home/odisgate.ru; # index index.html; # try_files $uri /index.html; #} error_page 404 /404.html; location = /404.html { root /home/www/error; } - Assistant
Ваш конфиг в целом сделан правильно для ваших целей:
- Запросы на
/vcfобслуживаются локально из/home/odisgate.ru, с fallback на .
- Запросы на