Getting phpMyAdmin working properly on Nginx+FreeBSD 8.1?

I've been looking at tutorials on phpMyAdmin for hours, nothing seems to work. I installed phpMyAdmin just fine, I just don't have it coming up for me on my site, I added the entry to the nGinx already as well.
 
Perhaps you could post your nginx configuration and give a little more input on what your are seeing.

Is nginx reporting a 404, 403, or 50x error?
Have you configured spawn-fcgi, php-fpm, or php-fastcgi as your backend to serve the php code?
 
redw0lfx said:
Perhaps you could post your nginx configuration and give a little more input on what your are seeing.

Is nginx reporting a 404, 403, or 50x error?
Have you configured spawn-fcgi, php-fpm, or php-fastcgi as your backend to serve the php code?

404.

Code:
#user nginx nginx;
worker_processes 4;

#error_log /usr/local/www/nginx/error_log info;

events {
	worker_connections 1024;
}

http {
	default_type application/octet-stream;

	client_header_timeout 66m;
	client_body_timeout 66m;
	send_timeout 66m;

	connection_pool_size 1024;
	client_header_buffer_size 128k;
	large_client_header_buffers 4 1024k;
	request_pool_size 512k;

	gzip on;
	gzip_min_length 1100;
	gzip_buffers 4 8k;
	gzip_types text/plain;

	output_buffers 1 3072;
	postpone_output 1460;

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;

	keepalive_timeout 75 20;

	ignore_invalid_headers on;

	index index.html;
	
	server_tokens off;
	client_max_body_size 10M;
	
	server {
		listen 80;
		server_name my-site.org;

		root /usr/local/www/nginx/;
                location ~ .php$ {
			if (!-f $request_filename) {
			return 404;
			}
                        fastcgi_pass 127.0.0.1:9000;
			include fastcgi.conf;
			fastcgi_intercept_errors on;
			fastcgi_read_timeout 360;
			fastcgi_connect_timeout 360;
			fastcgi_send_timeout 360;
			fastcgi_buffer_size 2048k;
			fastcgi_buffers 8 2048k;
			fastcgi_busy_buffers_size 2048k;
			fastcgi_temp_file_write_size 2048k;
                }

		location / {
        	if ($request_uri ~* (^\/|\.html|\.jpg|\.org|\.png|\.css|favicon\.ico|robots\.txt)$ ) {
          	break;
        	}
        	return 444;
      		}

        	location /phpmyadmin/ {
            		alias       /usr/local/www/phpMyAdmin/;
            		index index.php index.html;
        	}
 
        	location ~ ^/phpmyadmin/(.*\.php)$ {
            		root                /usr/local/www/phpMyAdmin/;
            		fastcgi_pass        unix:/tmp/php-fpm.sock;
            		include             fastcgi_params;
            		fastcgi_param       SCRIPT_FILENAME /usr/local/www/phpMyAdmin/$1;
            		fastcgi_param       DOCUMENT_ROOT /usr/local/www/phpMyAdmin;
        	}
	}
}
 
I believe the issue is in your configuration file. Your first
Code:
location ~ .php$
should be matching for url http://my-site.org/phpMyAdmin/index.php and its checking if that file exists or returns a 404. Since the file does not exist under /usr/local/www/nginx/phpMyAdmin/index.php, Nginx returns a 404 for you. This means that the request never makes it to the
Code:
location ~ /^phpmyadmin/(.*\.php)$ { ... }
block down in the configuration.

I would move the
Code:
location ~ .php$ { ... }
block to be after the phpMyAdmin blocks you have configured. Since Nginx processes things from top-down (first to show is what it will do).
 
Sorry, forgot to mention did you move the
Code:
location / { ... }
block as well, to be after the phpMyAdmin blocks? Did you get a 444 error this time? If you did, its probably that block that caught it, since you are specifically checking the file extension and then returning 444 if it doesn't match.

Also, the nginx error logs can give a good idea of why it failed. You should include that here as well as it could help.
 
Hi did you check folder letters cases? For example phpmyadmin or phpMyadmin.

Replace $1 with $fastcgi_script_name and retest it again.
 
Back
Top