Skip to content

Instantly share code, notes, and snippets.

@li0nel
Created December 9, 2017 11:12
Show Gist options
  • Save li0nel/a1a73b98583927fe393bb02e4aa225fe to your computer and use it in GitHub Desktop.
Save li0nel/a1a73b98583927fe393bb02e4aa225fe to your computer and use it in GitHub Desktop.
Enable Nginx rewrite to serve assets from CloudFront
location ~ \.php$ {
root /var/www/html/public;
fastcgi_cache cache_key;
fastcgi_cache_valid 200 204 1m;
fastcgi_ignore_headers Cache-Control;
fastcgi_no_cache $http_authorization $cookie_laravel_session;
fastcgi_cache_lock on;
fastcgi_cache_lock_timeout 10s;
add_header X-Proxy-Cache $upstream_cache_status;
sub_filter_types *;
sub_filter_once off;
sub_filter 'laravelaws-bucket-jjua0wgxhi7i.s3-ap-southeast-2.amazonaws.com' 'files.laravelaws.com';
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 900s;
include fastcgi_params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment