# Change YOUR_ACCESS_KEY to your Access Key # Change example.com (server_name) to your website url fastcgi_cache_path /var/cache/nginxfastcgi levels=1:2 keys_zone=fastcgicache:10m inactive=10m max_size=64m; fastcgi_cache_key $scheme$request_method$host$request_uri$http_x_prerender$http_user_agent; fastcgi_cache_lock on; fastcgi_cache_use_stale error timeout invalid_header updating http_500; fastcgi_cache_valid 5m; map $http_user_agent $spider_ua { default 0; "~*BotView" 0; "~*googlebot|yahoo!\\ slurp|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\\ link\\ preview|showyoubot|outbrain|pinterest\\/0\\.|developers.google.com\\/\\+\\/web\\/snippet|slackbot|vkshare|w3c_validator|redditbot|applebot|whatsapp|flipboard|tumblr|bitlybot|skypeuripreview|nuzzel|discordbot|google\\ page\\ speed|qwantify|pinterestbot|bitrix\\ link\\ preview|xing-contenttabreceiver|chrome-lighthouse|telegrambot|google-inspectiontool|petalbot" 1; } map $args $spider_args { default $spider_ua; "~(^|&)_escaped_fragment_=" 1; } map $http_x_spider $x_spider { default $spider_args; "1" 0; } map $uri $spider { default $x_spider; "~*\\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|woff2|svg|eot)" 0; } server { listen 443 ssl; listen [::]:443 ssl; server_name www.example.com; root /var/www/html/clrhtml/public; index index.html index.htm index.php; ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem; access_log /var/log/nginx/nginx.vhost.access.log; error_log /var/log/nginx/nginx.vhost.error.log debug; location / { if ($spider = 1) { rewrite (.*) /spider last; } try_files $uri $uri/ =404; } location ~ \.php$ { if ($spider = 1) { rewrite (.*) /spider last; } include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /spider { if ($spider = 0) { return 404; } set $backend "spider.services.utility-server.com"; proxy_pass https://$backend; proxy_set_header Host $server_name; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; resolver 8.8.8.8 8.8.4.4 valid=300s; proxy_redirect off; proxy_buffering off; proxy_buffer_size 16k; proxy_busy_buffers_size 24k; proxy_buffers 64 4k; rewrite .* /$scheme://$host$request_uri? break; } location ~ /\.ht { deny all; } }