server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ /index.php?$args;
}
# phpMyAdmin
location /phpmyadmin {
alias /usr/share/phpmyadmin/;
index index.php;
location ~ ^/phpmyadmin/(.+\.php)$ {
alias /usr/share/phpmyadmin/$1;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
location ~* ^/phpmyadmin/(.+\.(css|js|png|jpg|jpeg|gif|ico|html|xml|txt))$ {
alias /usr/share/phpmyadmin/$1;
}
}
# PHP
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
# deny access to hidden files
location ~ /\.ht {
deny all;
}
}