user www-data; worker_processes auto; pcre_jit on; error_log /dev/stderr warn; include /etc/nginx/modules/*.conf; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; server_tokens off; client_max_body_size 10m; sendfile on; tcp_nopush on; gzip_vary on; map $http_upgrade $connection_upgrade { default upgrade; '' close; } log_format traceable '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" "$request_id"'; server { listen 80 default_server; listen [::]:80 default_server; error_log /dev/stderr warn; access_log /dev/stdout traceable; add_header X-Request-Id $request_id always; root /app/public; index index.html index.php; charset utf-8; location = /favicon.ico { access_log off; log_not_found off; return 204; } location / { try_files $uri $uri/ /index.php?$query_string; } location ~* (index|test)\.php$ { # regex to split $uri to $fastcgi_script_name and $fastcgi_path fastcgi_split_path_info ^(.+?\.php)(/.*)$; # Check that the PHP script exists before passing it try_files $fastcgi_script_name =404; # Bypass the fact that try_files resets $fastcgi_path_info # see: http://trac.nginx.org/nginx/ticket/321 set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; # For better request tracking. fastcgi_param X_REQUEST_ID $request_id; fastcgi_index index.php; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } location ~ /\.ht { deny all; } } }