Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;

        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 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/ file so that I can connect to a remote MySQL Database.

What else do I need to do?

share|improve this question
up vote 1 down vote accepted

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;
share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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