Configuring phpmyadmin

Hi,

I recently installed Debian 6.0.1a Squeeze with Nginx and phpmyadmin
When I go to ‘http://localhost’ phpmyadmin pops up.
What I want is that phpmyadmin is located at
http://localhost/phpmyadmin/

I already tried to add this in nginx.conf. It didn’t work

location /phpmyadmin {
alias /usr/share/phpmyadmin/;
}

This is what my nginx.conf looks like:


user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log  /var/log/nginx/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}


Can anybody help me configuring this the right way?

Posted at Nginx Forum:

Post your /etc/nginx/sites-enabled/ files and also, keeping phpmyadmin
on a public directory is bad since bots / scripts automatically scan
for that in URLs. Restrict it with .htaccess if you want to keep
phpmyadmin as the directory name or change it to something like
“fuzzykittens” to hide it.

On 5/24/11, Trazzt [email protected] wrote:

alias /usr/share/phpmyadmin/;

sendfile        on;
include /etc/nginx/sites-enabled/*;

nginx mailing list
[email protected]
nginx Info Page


–C

“The dumber people think you are, the more surprised they’re going to
be when you kill them.” - Sir William Clayton

Okay thx for the tip I’m new to this :wink:
Here it is:

phpmyadmin:


server{
listen 80;
server_name phpmyadmin;
access_log /var/log/phpmyadmin.access_log;
error_log /var/log/phpmyadmin.error_log;

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

location ~ \.php$ {
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_index   index.php;
    fastcgi_param   SCRIPT_FILENAME

/usr/share/phpmyadmin$fastcgi_script_name;
include fastcgi_params;
}
}


This is my fastcgi_script, located at “/etc/init.d/php-fastcgi”
http://pastie.org/1970419

I also have one other site enabled, I don’t know if thats relevant but
you can find it here.
I want this site to be located at ‘localhost’
http://pastie.org/1970411

Posted at Nginx Forum:

On Wed, May 25, 2011 at 05:41:14AM -0400, Trazzt wrote:

    include         fastcgi_params;

I want this site to be located at ‘localhost’
http://pastie.org/1970411

You probably need

location / {
    return 404;
}

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

location ~ ^/phpmyadmin/\.php$ {
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME /usr/share$fastcgi_script_name;
    include         fastcgi_params;
}


Igor S.

Thank you, that did the trick!
Only I have a new problem now. PHP looks suddenly disabled
I get a text file, when I visit: ‘127.0.0.1/phpmyadmin’
Like this:
http://postimage.org/image/2j6o8olyc/

I already tried to add the line:
fastcgi_index index.php;
and restarting nginx. That didn’t work
Rebooting also didn’t help

Do you know how I can enable PHP again?

Posted at Nginx Forum:

On Wed, May 25, 2011 at 06:13:49AM -0400, Trazzt wrote:

Thank you, that did the trick!
Only I have a new problem now. PHP looks suddenly disabled
I get a text file, when I visit: ‘127.0.0.1/phpmyadmin’
Like this:
http://postimage.org/image/2j6o8olyc/

I already tried to add the line:
fastcgi_index index.php;
and restarting nginx. That didn’t work

You do not need this directive.

Rebooting also didn’t help

Do you know how I can enable PHP again?

  • location ~ ^/phpmyadmin/.php$ {
  • location ~ ^/phpmyadmin/.+.php$ {

This is yet one of the reasons why I try to avoid as much as possible
regex locations - too high mistake probability if you do not write or
read
a hundrend regexes a day.


Igor S.

On 05/25/11 12:58, Trazzt wrote:

I really appreciate your help, but PHP is still not working
This is how my phpmyadmin configuration file looks like after all your
edits:

 location ~ ^/phpmyadmin/.+\.php$ {
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
 include fastcgi_params;

I found I had to use:

fastcgi_param SCRIPT_FILENAME $request_filename;

I don’t really understand why.

Dick

On Wed, May 25, 2011 at 01:04:44PM +0100, Dick M. wrote:

I found I had to use:

fastcgi_param SCRIPT_FILENAME $request_filename;

I don’t really understand why.

$request_filename is “$document_root$uri”.

http://sysoev.ru

On Wed, May 25, 2011 at 07:58:21AM -0400, Trazzt wrote:

I really appreciate your help, but PHP is still not working

What does it means - “PHP is still not working” ?

return 404;
include fastcgi_params;
  }

}


http://sysoev.ru

I really appreciate your help, but PHP is still not working
This is how my phpmyadmin configuration file looks like after all your
edits:


server{
listen 80;
server_name phpmyadmin;
access_log /var/log/phpmyadmin.access_log;
error_log /var/log/phpmyadmin.error_log;

location / {
return 404;
  }

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

location ~ ^/phpmyadmin/.+\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
include fastcgi_params;
  }

}


Posted at Nginx Forum:

On Wed, May 25, 2011 at 09:07:30AM -0400, Trazzt wrote:

I mean I still get the text screen like in the image. I still get no
layout, only the ‘index.php’ file in text format.
Like in the screenshot:
http://postimage.org/image/2j6o8olyc/

Try to add localhost and 127.0.0.1 to ensure that you request a right
server:

server{
listen 80;
server_name phpmyadmin localhost 127.0.0.1;


Igor S.

I mean I still get the text screen like in the image. I still get no
layout, only the ‘index.php’ file in text format.
Like in the screenshot:
http://postimage.org/image/2j6o8olyc/

Posted at Nginx Forum:

I tried what you said, but I still get the text file.

Thanks for all your support, I’m gonna reinstall phpmyadmin completely
using the configuration files you supplied.

I used this tutorial to install nginx + phpmyadmin, I’ll search for
another tut.

Posted at Nginx Forum:

On Wed, May 25, 2011 at 09:34:57AM -0400, Trazzt wrote:

I tried what you said, but I still get the text file.

Thanks for all your support, I’m gonna reinstall phpmyadmin completely
using the configuration files you supplied.

I used this tutorial to install nginx + phpmyadmin, I’ll search for
another tut.

Could you create debug log of the request ?
http://nginx.org/en/docs/debugging_log.html


Igor S.

On Wed, May 25, 2011 at 02:56:07PM +0100, Dick M. wrote:

 fastcgi_pass 127.0.0.1:9000;
 location /phpmyadmin {

index index.php;

    location  ~ \.php$ {
    ...
    }
 }

No?

Yes, inclusive “location ~ .php$” is much better than configuration
I suggested.

However, my configuration should also work, since /phpmyadmin/ is
internally redirected to /phpmyadmin/index.php, see for details:
http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration


Igor S.

Igor S. Wrote:

 listen 80;
 root /usr/share;

nginx mailing list
[email protected]
nginx Info Page

I’m trying to explain to you why I can’t debug the file, but the forum
says
Possible hack attempt detected. The posted form data was rejected.

I’m having trouble running the “./configure” command, when I try to run
it in terminal

When I uninstalled nginx, somehow apache2 started, while I never
installed apache2
I couldn’t uninstall apache, because only the apache2 service was on my
pc, and no installation files.

Maybe this is causing the nginx errors.

Posted at Nginx Forum:

On 05/25/11 12:58, Trazzt wrote:

 location / {
 fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
 include fastcgi_params;
   }

}

I’m not sure which location /phpmyadmin/ is served from. If it’s the
first, as I suspect, then there’s no way index.php is going to be
processed.

I would use:

 location /phpmyadmin {

index index.php;

    location  ~ \.php$ {
    ...
    }
 }

No?

Dick

I’m trying to explain to you why I can’t debug the file, but the forum
says
Possible hack attempt detected. The posted form data was rejected.

The forum is a gateway to mailing list:
http://nginx.org/mailman/listinfo/nginx
You may write there.


Igor S.