Skip to content

Instantly share code, notes, and snippets.

@irgendwr
Created March 25, 2019 16:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irgendwr/187a64ffc87e73ce198921e0214cd768 to your computer and use it in GitHub Desktop.
Save irgendwr/187a64ffc87e73ce198921e0214cd768 to your computer and use it in GitHub Desktop.
Nginx snippet for serving phpmyadmin in a custom subdirectory
location /pma {
alias /usr/share/phpmyadmin;
try_files $uri $uri/ @pma =404;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; # <-- change this to fit your installation
}
}
location @pma {
rewrite /pma/(.*)$ /pma/index.php?/$1 last;
}
# based on: https://serversforhackers.com/c/nginx-php-in-subdirectory
@heroselohim
Copy link

This snippet saved my life! Thanks 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment