# Include in http {}. Configure TLS before exposing this site to the internet. server { listen 80; server_name app.example; root /srv/www/app.example/public; index index.php; autoindex off; disable_symlinks on from=$document_root; location / { try_files $uri $uri/ /index.php$is_args$args; } location = /index.php { try_files /index.php =404; include fastcgi_params; fastcgi_param HTTP_PROXY ""; fastcgi_param SCRIPT_FILENAME $document_root/index.php; fastcgi_pass unix:/run/php/app.sock; } # Only index.php runs. The public root should contain only public assets. location ~* \.php(?:/|$) { return 404; } location ~ /\. { deny all; } }