server { listen 80; server_name localhost; root /var/www/public; index index.php index.html; # Logging access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # Laravel location configuration location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_pass app:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; fastcgi_hide_header X-Powered-By; # Increase timeouts for debugging fastcgi_read_timeout 3600; fastcgi_send_timeout 3600; } location ~ /\.(?!well-known).* { deny all; } # Deny access to sensitive files location ~ /\.env { deny all; } # Cache static assets location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # Gzip compression gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; gzip_disable "msie6"; client_max_body_size 100M; }