I want to use nginx as a reverse proxy for multiple apps (in docker). They exist in separate directories in the nginx container: /var/www/app1
, /var/www/app2
, etc.
My default.conf
:
resolver 127.0.0.11 valid=15s;
server {
listen 80;
server_name www.example.com example.com;
set $upstream phpmyadmin:9000;
location ^~ /phpmyadmin {
#alias /var/www/html/; # <----- this works
alias /var/www/phpmyadmin/;
index index.php;
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass $upstream;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
}
If I mount the docker app (phpmyadmin) in /var/www/html/
then the above nginx config works.
But what I really want is to mount it in /var/www/phpmyadmin/
. When I do that I get errors:
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream