#NginX PHPMyAdmin 404

4 messages · Page 1 of 1 (latest)

calm talon
#

I have NginX and phpmyadmin with the necessary modules and extentions installed according to the wiki.
I can serve php files just fine when I use the config from here https://wiki.archlinux.org/title/Nginx#PHP_implementation

Now I want to make the /phpMyAdmin path redirect to the phpmyadmin installation at /usr/share/webapps/phpmyadmin/

server {
    server_name localhost;
    listen 80;
    listen [::]:80;
    index index.php;
    access_log /var/log/nginx/domain.tld.access.log;
    error_log /var/log/nginx/domain.tld.error.log;

    root /usr/share/nginx/html;
    # location / {
    #    try_files $uri $uri/ =404;
    #    autoindex on;
    #}

    location /phpMyAdmin {
        root /usr/share/webapps/phpMyAdmin;
    autoindex on;
    }
    location ~ ^/phpMyAdmin/(README|LICENSE|ChangeLog|DCO)$ {
       deny all;
    }
    location ~ ^/phpMyAdmin/(.+\.md)$ {
      deny all;
   }
   location ~ ^/phpMyAdmin/(doc|sql|setup)/ {
      deny all;
   }
   location ~ /phpMyAdmin/(.+\.php)$ {
      try_files $uri $document_root$fastcgi_script_name =404;

      fastcgi_split_path_info ^(.+\.php)(/.*)$;
      fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;

      fastcgi_param HTTP_PROXY "";
      fastcgi_param HTTPS off;
      fastcgi_request_buffering off;
   }
}

I mostly copied this, only adjusting for localhost
Trying to access localhost/phpMyAdmin gives a 404 though

#

?? Looks like the location ~ /phpMyAdmin/(.+\.php)$ location also needed a root /usr/share/webapps; for some reason

#

Can somebody explain why that is missing the wiki, while it is necessary?