Environment:
CentOS 7.4 x64
Nignx 1.14
PHP 7.2.6
configuration file Nginx.conf root / root is / web/public, phpmyadmin is placed in / web/phpmyadmin,
location /phpmyadmin/ {
alias /web/phpmyadmin/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+?\.php)(/.*)?$ {
alias /web/phpmyadmin/;
fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /web/phpmyadmin/$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/phpmyadmin/(.+)\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)(/.*)?$ {
alias /web/phpmyadmin/;
expires 6d;
}
}
the configuration code as above always prompts a 404 error.
Nignx error message: FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
if you use the root setting, there will be no problem, speechless.
location /phpmyadmin/ {
root /web;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+?\.php)(/.*)?$ {
root /web;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/phpmyadmin/.*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico|js|css)$ {
root /web;
expires 7d;
}
}