I'm trying to create an NGINX config for PHP that will run on a docker setup. Using some NGINX/PHP guides online, I created a conf file intended to get all requests to the server except files that exist, but when I hit the base url, Chrome downloads a file with the content of my index.php
, unprocessed. If I hit any other page, I 404.
server {
index index.php;
server_name gamersplane.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/api;
location .* {
try_files $uri =404;
rewrite .* index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass api:9000;
fastcgi_index index.php;
fastcgi_param HTTP_PROXY '';
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
I feel like I'm supposed to create a location block for anything not .php, before the existing location block, but I can't seem to figure out where I've gone wrong. Is the conf wrong, or is there something wrong with my docker setup that's preventing communication? Not sure how to tell which.