I have setup a domain name to run on amazon ec2 running ubuntu 11.04, nginx and php5-fpm.

The domain name works great, I have setup it's own sites-available configuration file and sym-linked it to sites-enabled.

I installed phpmyadmin via sudo apt-get install phpmyadmin and followed the instructions.

I then added this just above my /etc/nginx/nginx.conf file and restarted nginx.

server {
        listen    80;
        server_name     phpmyadmin.domain.com;

        location / {
                root /usr/share/phpmyadmin;
                index index.php;

        #make sure all php files are processed by fast_cgi
        location ~ \.php {
                # try_files $uri =404;

                fastcgi_index index.php;

                include fastcgi_params;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


I have also added the appropriate dns A records for phpmyadmin.domain.com

phpmyadmin.domain.com just shows a 404 error code. All other subdomains do not respond at all so at least something is working here.

FYI I have edited the /etc/phpmyadmin/config.inc.php file so that I can connect to a remote MySQL Database.

What else do I need to do?


You are missing the nginx root directive in .php location block

something like this:

    location ~ \.php$ {
        root   /path/to/public_html;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME /path/to/html$fastcgi_script_name;
        include     fastcgi_params;

All that was needed was a simply symlink between /usr/share/phpmyadmin and my default web folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.