PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 23, 2022

[FIXED] phpMyAdmin 404 error on Digital Ocean hosting

 January 23, 2022     digital-ocean, nginx, phpmyadmin     No comments   

Issue

I'm getting a 404 error after install phpMyAdmin using Digital Ocean's guide. I have multiple domains setup on Ubuntu running nginx. There is a phpmyadmin directory within /var/www/. The only difference from the guide was the following command:

sudo ln -s /usr/share/phpmyadmin/ /var/www

Do I need to add server block possibly? Since I have multiple domains, each of them has a separate configuration file.

Sample config file:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/domain1.com/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name MY_IP_ADDRESS;

    location / {
        try_files $uri $uri/ =404;
    }

    location /phpmyadmin {
        root     /var/www/;
        index index.php index.html;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
        include        fastcgi_params;
        try_files      $uri /index.php;
    }

    location ~ /\.ht {
        deny all;
    }
}

I'm not great at server administration. Any suggestions?


Solution

Define this server block it worked for me. A basic configuration for phpmyadmin in you case.As you have created a symbolic link in /var/www.

sudo ln -s /usr/share/phpmyadmin/ /var/www

server {

    listen 80;
    server_name website.in www.website.in;
    autoindex on;

    location /phpmyadmin {
        root /var/www/;
        index index.php index.html;

        location ~ \.php$ {
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
            include        fastcgi_params;
            try_files      $uri $uri/ /index.php;
        }
    }   

    location / {
        root /var/www/your/path;
        index index.php index.html;

        location ~ \.php$ {
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root/$fastcgi_script_name;
            include        fastcgi_params;
            try_files      $uri $uri/ /index.php;
        }
    }
}


Answered By - Sahil Gulati
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,217,378

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing