phpmyadmin 403 forbidden

wrknight

New member
I am setting up wordpress on a LEMP stack and my root directory is /var/www/html. According to instructions I simlinked /usr/share/phpmyadm to /var/www/html/phpmyadmin where is shows up. I am workiing on a local network so when I want to acess phpmyadmin I put 127.0.0.1/phpmyadmin in the address bar of my browser and it sends back 403 forbidden. If I remove the simlink, refeshing the browser sends back 404 not found. Replacing the simlink sends back 403 forbidden, so I know the simlink is in the right place.

nginx log reports:
2025/01/31 01:51:31 [error] 38157#38157: *149 directory index of "/var/www/html/phpmyadmin/" is forbidden, client: 127.0.0.1, server: _, request:

I tried setting up a made up domain called site1.com, placed the root directory at /var/www/site1 and simlinked phpmyadmin to that location. This time it came back with 2025/01/31 04:33:52 [error] 40563#40563: *45 directory index of "/var/www/site1/phpmyadmin/" is forbidden, client: 192.168.1.199, server: site1.com,.

Any thoughts on how to fix this?
 
403 errors usually indicate that there is a permissions issue. Check that the /usr/share/phpmyadmin directory and its contents have the correct permissions. Also, check that your Nginx configuration allows access to the PHPMyAdmin directory. You should have a location block similar to this in your Nginx configuration file:
Code:
location /phpmyadmin {
    root /var/www/html;
    index index.php index.html index.htm;
    location ~ ^/phpmyadmin/(.*\.php)$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Adjust PHP version as necessary
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
After checking these, restart nginx with this command:
Code:
sudo systemctl restart nginx
Now, try accessing 127.0.0.1/phpmyadmin again.
 
Back
Top