roro
By:
roro

Can't access phpMyAdmin after installing on new droplet made with "Drupal on Ubuntu" one-click application?

November 9, 2014 4.2k views

Here's what I did:

1) I created a new droplet using the "Drupal 7.32 on Ubuntu 14.04" one-click application. This creates a LEMP server with Drupal install at /var/www/html/drupal
2) Next I followed the steps on how to setup the initial server using the tutorial at Initial Server Setup with Ubuntu 14.04.
3) I then followed the steps on how to install phpMyAdmin on a LEMP server at How To Install and Secure phpMyAdmin with Nginx on an Ubuntu 14.04 Server

The article in step 3 above said to use the ln command to create a symlink like this:

sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html

But that didn't work so I asked for help at the bottom of that tutorial and contributor "kamain7" suggested I create the symlink like this:

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

But that didn't work either and no one else has volunteered any other advice. Is it something with the symlink? Is their something odd with the Drupal on Ubuntu one-click application I am not aware of? Am I doing something wrong?

Please help.

6 comments
  • I have same problem and couldn't find any solution. I tried everything but still getting 404 not found error.

  • Also having this issue. Still haven't found a fix

  • It's been more than a month since I posted my original comment and I havenot found the solution and no one at Digital Ocean has fixed it or told me what I'm doing wrong. Very discouraging.

  • @roro, @fubofo I found a solution finally, hopefully it works with you too.

    Install phpmyadmin properly and add this lines to your /etc/nginx/sites-available/drupal 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:/var/run/php5-fpm.sock; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    include fastcgi_params; 
    } 
    
    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; 
    } 
    } 
    
    location /phpMyAdmin { 
    rewrite ^/* /phpmyadmin last; 
    } 
    
    

    and restart php5-fpm and nginx.

    service php5-fpm restart
    service nginx restart
    
    

    here is my full nginx configuration page:

    server {
      listen 80 default_server;
      listen [::]:80 default_server ipv6only=on;
    
      root /var/www/html/drupal;
      index index.php index.html index.htm;
    
      error_page 404 /404.html;
      error_page 500 502 503 504 /50x.html;
      location = /50x.html {
          root /usr/share/nginx/html;
      }
    
      location = /favicon.ico {
        log_not_found off;
        access_log off;
       }
    
    
    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:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; } 
    
    
       location = /robots.txt {
         allow all;
         log_not_found off;
         access_log off;
       }
    
       location ~ \..*/.*\.php$ {
         return 403;
       }
    
       location ~ ^/sites/.*/private/ {
         return 403;
       }
    
       location ~ (^|/)\. {
         return 403;
       }
    
       location / {
         try_files $uri @rewrite;
       }
    
       location @rewrite {
         rewrite ^ /index.php;
       }
    
       location ~ \.php$ {
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_param SCRIPT_FILENAME $request_filename;
         fastcgi_intercept_errors on;
         fastcgi_pass unix:/var/run/php5-fpm.sock;
              include fastcgi_params;
       }
    
    
            location ~ ^/sites/.*/files/styles/ {
                    try_files $uri @rewrite;
            }
    
            location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                    expires max;
                    log_not_found off;
            }
    
    }
    
    
  • @zgurb I finally found time to try your solution and it worked! Thanks!

  • Thank you very much my friend. Greatly appreciated.

1 Answer

This question was answered by @zgurb:

@roro, @fubofo I found a solution finally, hopefully it works with you too.

Install phpmyadmin properly and add this lines to your /etc/nginx/sites-available/drupal 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:/var/run/php5-fpm.sock; 
fastcgi_index index.php; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
include fastcgi_params; 
} 

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

location /phpMyAdmin { 
rewrite ^/* /phpmyadmin last; 
} 

and restart php5-fpm and nginx.

service php5-fpm restart
service nginx restart


here is my full nginx configuration page:

server {
 listen 80 default_server;
 listen [::]:80 default_server ipv6only=on;

 root /var/www/html/drupal;
 index index.php index.html index.htm;

 error_page 404 /404.html;
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
     root /usr/share/nginx/html;
 }

 location = /favicon.ico {
   log_not_found off;
   access_log off;
  }


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:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; } 


  location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
  }

  location ~ \..*/.*\.php$ {
    return 403;
  }

  location ~ ^/sites/.*/private/ {
    return 403;
  }

  location ~ (^|/)\. {
    return 403;
  }

  location / {
    try_files $uri @rewrite;
  }

  location @rewrite {
    rewrite ^ /index.php;
  }

  location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_intercept_errors on;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
        include fastcgi_params;
  }


       location ~ ^/sites/.*/files/styles/ {
               try_files $uri @rewrite;
       }

       location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
               expires max;
               log_not_found off;
       }

}

View the original comment

Have another answer? Share your knowledge.