PhpMyAdmin + NGINX + Ubuntu 12.04

April 19, 2014 17.5k views
Hi, I have installed PhpMyAdmin by following the guides here: https://www.digitalocean.com/community/articles/how-to-install-phpmyadmin-on-a-lemp-server 1. sudo apt-get install phpmyadmin 2. sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www 3. sudo nano /etc/nginx/sites-available/example.com 4. Add the following lines: location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; } location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } 5. Save and exit 6. sudo service nginx restart But when I navigate to example.com/phpmyadmin I get a blank page. I also get a blank page when navigating to example.com/phpmyadmin/index.php Any help would be great.
4 Answers
Issue resolved. phpmyadmin now works. I changed the etc/nginx/sites-available/example.com

and added the following lines:

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;
}



Hello, I think I have the solution for your problem, in step 3 you have the website file in /etc/nginx/sites-available. The file must be in sites-enabled, use:
ln -s etc/nginx/sites-available/example.com etc/nginx/sites-enabled/
Take care.
@Sianios - I have already enabled sites-enabled. Both virtual host contains the same information.

Here is the information in both /etc/nginx/sites-available/example.com and /etc/nginx/sites-enabled/example.com

server {
listen 80;


root /var/www/example.com/public_html;
index index.php index.html index.htm;

server_name example.com www.example.com;

location / {
try_files $uri $uri/ /index.html /index.php;
autoindex on;
}

error_page 404 /404.html;

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

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
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 {
root /usr/share;
index index.php index.html index.htm;
}
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share;
}

Help please :( my web site example.com/phpmyadmin/index.php

No input file specified.

Have another answer? Share your knowledge.