Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to install phpmyadmin on my nginx web server. I installed phpmyadmin without a problem. I created subdomain for it. For security reasons I didnt call my subdomain "phpmyadmin" i used a different name. Then I used this config for my subdomain

server {
    listen   80;
    server_name myphpmyadminsubdomain.domain.com;
    access_log off;
    error_log /srv/www/myphpmyadminsubdomain/error.log;

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

location ~ \.php$ {
    try_files $uri =404;

    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#   fastcgi_intercept_errors on;
    fastcgi_pass php;
}

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

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

location ~ /\. {
    deny all;
    access_log off;
    log_not_found off;
}
      }

Then I enabled it like this;

/etc/nginx/sites-available/myphpmyadminsubdomain /etc/nginx/sites-enabled/myphpmyadminsubdomain

I have restarted the nginx and go to myphpmyadminsubdomain.domain.com and it is giving me nginx 404 Not Found error.

what am I doing wrong?

share|improve this question
    
I had this same issue but forgot the solution. Try hard coding the fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; line with your document root. –  jeffatrackaid Nov 18 '11 at 16:21
    
tried, it didint work sorry =/ –  borannb Nov 18 '11 at 16:40
    
Do the static files (eg /robots.txt) work? Is there anything in the nginx error log? –  Shish Nov 18 '11 at 16:40
    
the error is this 2011/11/18 16:53:29 [error] 3955#0: *1 directory index of "/srv/www/mysubdomain/" is forbidden, client: XX.XX.XXX.XXX, server: mysubdomain.domain.com, request: "GET / HTTP/1.1", host: "mysubdomain.domain.com" –  borannb Nov 18 '11 at 16:47
    
Sounds like a permissions issue then. Check that your nginx user can reach those areas. I temp. set the user to have a bash shell and then use "su -" to that user and navigate to the files required. –  jeffatrackaid Nov 18 '11 at 16:58
show 1 more comment

2 Answers 2

It is usually a path problem. In nginx.conf set

fastcgi_param SCRIPT_FILENAME /absolute/path/to/server/root$fastcgi_script_name;

Note that there is no slash after the last dir in the path. Secondly, fastcgi_pass to either a socket or a local URL.

Are you chrooting your php-cgi? Then all paths have to be relative to that chroot.

share|improve this answer
add comment

This is my configuration

server {
    listen 80; ## listen for ipv4
    server_name pma.example.com;
    access_log /var/log/nginx/pma.access.log;
    error_log       /var/log/nginx/pma.error.log;
    root /server/phpmyadmin/phpMyAdmin-3.4.2-all-languages;

    location / {
            index index.php index.html;
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include /etc/nginx/fastcgi_params;
            fastcgi_intercept_errors off;
            fastcgi_pass php;
    }

}

The root should be changed to /usr/share/phpmyadmin and the fastcgi_params should be changed appropriately.

share|improve this answer
add comment

Your Answer

 
discard

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.