0

I installed phpmyadmin on Debian Stretch with nginx, but get 404 when navigating to http://blah.com/phpmyadmin, no errors in the logs. Here's my default file

vi /etc/nginx/sites-available/default
  server {
  listen 80 default_server;
  listen [::]:80 default_server;
  root /var/www/html;
  server_name _;
  location / {
    try_files $uri $uri/ =404;
  }
  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  }
  location /phpmyadmin/ {
            alias /usr/share/phpmyadmin/;
            index  index.html index.htm index.php;
            location ~ ^/pmadmin(.+\.php)$ {
                    alias /usr/share/phpmyadmin$1;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1;
                    include fastcgi_params;
                    fastcgi_intercept_errors        on;
  }
}

What am I missing?

batflaps
  • 179
  • 1
  • 3
  • 10

1 Answers1

1

You seem to have misspelled phpmyadmin as pmadmin in the second nested location.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Thanks, that helped, but now I get a 502 Bad Gateway error. – batflaps Feb 19 '18 at 16:17
  • @batflaps Did you start the other php-fpm service? You are asking to run phpmyadmin under, it appears, some PHP 5, rather than the PHP 7.0 the rest of this `server` uses. – Michael Hampton Feb 19 '18 at 17:31
  • Yeah, I restarted php7.0-fpm, still same error. Now in /var/log/nginx/error.log I see `*3 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream` – batflaps Feb 19 '18 at 23:29
  • @batflaps Please read the _second_ sentence in my previous comment. – Michael Hampton Feb 19 '18 at 23:30
  • Yes, I updated to correct sock like `fastcgi_pass unix:/var/run/php/php7-fpm.sock;` and reloaded file and it works :) – batflaps Feb 19 '18 at 23:39