By Small Giants
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;
}
}
Any suggestions?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
For the location /phpmyadmin block, you may want to use alias instead of root. You also want to set either the root or alias to the actual directory that phpMyAdmin is located in.
So if /var/www/phpmyadmin exists (even as a symlink), then you want to use:
root /var/www/phpmyadmin;
or
alias /var/www/phpmyadmin;
You also shouldn’t need the try_files $uri /index.php; definition in the block that handles your PHP / PHP-FPM request processing. Ideally you’d set that per block as that gives you more control over what happens within each location.
For example, WordPress may handle rewrites differently than Drupal, which will handle them differently than phpMyAdmin (if it does at all), etc.
The 404 error is resulting as index.php doesn’t exist in /var/www, which is where it’s looking when a request for /phpmyadmin is routed.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.