server { listen 80 default_server; root /usr/share/nginx/html; location ^~ /tkr { index index.php; alias /tkr/public; location ~ ^/tkr(/.+\.php)$ { fastcgi_pass php:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /tkr/public/$1; fastcgi_param SCRIPT_NAME $uri; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; } } # Deny anything else location / { try_files $uri $uri/ =404; } # Deny access to hidden or stray files location ~* \.(htaccess|env|ini|log|bak)$ { deny all; } }