Skip to content

Instantly share code, notes, and snippets.

@joulgs
Created October 2, 2023 13:56
Show Gist options
  • Save joulgs/3ba476e4d03a8f40ce292c42803dfb86 to your computer and use it in GitHub Desktop.
Save joulgs/3ba476e4d03a8f40ce292c42803dfb86 to your computer and use it in GitHub Desktop.
How install phpmyadmin in debian/ubuntu whit nginx

need install:

  • php-fpm
  • nginx

sudo apt install phpmyadmin

create into /etc/nginx/snippets the file phpmyadmin.conf

add in file:

location /phpmyadmin {
    root /usr/share/;
    index index.php index.html index.htm;
    location ~ ^/phpmyadmin/(.+\.php)$ {
        try_files $uri =404;
        root /usr/share/;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }

    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/share/;
    }
}

! attemption to your php-fpm.sock path

in nginx site file config add into server sector the line:

include snippets/phpmyadmin.conf;

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