map $FRONTEND_PORT $host_with_port { "" $host; default "$host:$FRONTEND_PORT"; } server { listen 80 default_server; listen [::]:80 default_server; client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE}; disable_symlinks if_not_owner from=/usr/share/nginx/html; index index.html; root /usr/share/nginx/html; ${GZIP_BLOCK} ${REAL_IP_BLOCK} location / { location / { try_files $uri @fallback; } location ~ \.php$ { return 404; } location ~ /\. { return 404; } location ~ /\.(ht|svn|git) { return 404; } } location @fallback { fastcgi_pass ${BACKEND_HOST}:${BACKEND_PORT}; fastcgi_index index.php; fastcgi_param REDIRECT_STATUS 200; fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param HTTP_HOST $host_with_port; include /etc/nginx/fastcgi_params; } }