Config help needed

Hi all,

I am trying, and failing to set up a server to serve phpmyadmin.

This is my config (one of about 30 tried).

server {
listen 80 default;
server_name default.anake.hcs localhost;
index index.php index.htm index.html;
root /var/www/nginx-default/;
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
#
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
location ~ .php$ {
set $php_root $document_root;
if ($request_uri ~* /phpmyadmin) {
set $php_root /usr/share;
}
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
#
# phpmyadmin - installed in /usr/share/phpmyadmin/index.php etc
#
location /phpmyadmin {
root /usr/share;
index index.php;
}
}

Results
/test.php Correct. Properly passes
/var/www/nginx-default/tesst.php to fast-cgi and displays the results
/phpmyadmin No input file specified. *
*/phpmyadmin/ No input file specified.
/phpmyadmin/index.php No input file specified.

I’m using nginx/0.7.67

Help much appreciated

Regards
Ian

On Fri, Jul 23, 2010 at 12:12 AM, Ian H. [email protected]
wrote:

   root  /var/www/nginx-default/;
   #
   # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
   #
   location ~ .php$ {
      fastcgi_param SCRIPT_FILENAMEÂ
$document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi.conf;
      fastcgi_pass  127.0.0.1:9000;
   }
   location ~ ^/phpmyadmin/.*.php$ {
        root /usr/share;
      fastcgi_param SCRIPT_FILENAMEÂ
$document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi.conf;
      fastcgi_pass  127.0.0.1:9000;
   }
   #
   # phpmyadmin - installed in /usr/share/phpmyadmin/index.php etc
   #
#phpmyadmin login page is horribly broken when accessed without
extra slash
location = /phpmyadmin { rewrite ^ /phpmyadmin/ redirect; }

Hi All,

Found what was happening but I don’t know how to fix it.

if I remove the clause starting "location ~ .php$ { " then phpmyadmin
works.

How can I stop it firing when the URL does NOT contain “phpmyadmin” ???

This is the full config.

Hi Edho,

On 22/07/2010 18:38, Edho P Arief wrote:

A suggestions that I think should have worked, but…

I tried your suggestions - and they had no effect whatsoever.

This is the current, failing, config - copied from a log, so you can see
exactly what I have

[email protected]:/etc/nginx/sites-enabled$ ls -al
total 8
drwxr-xr-x 2 root root 4096 2010-07-22 10:18 .
drwxr-xr-x 5 root root 4096 2010-06-21 14:36 …
lrwxrwxrwx 1 root root 38 2010-06-21 14:33 coachmaster ->
/etc/nginx/sites-available/coachmaster
lrwxrwxrwx 1 root root 34 2010-06-21 14:36 default ->
/etc/nginx/sites-available/default
lrwxrwxrwx 1 root root 36 2010-07-22 10:18 SOPSystem ->
/etc/nginx/sites-available/SOPSystem
[email protected]:/etc/nginx/sites-enabled$ cat default

default server - if no other domain given

- also handle phpmyadmin

server {
listen 80 default;
server_name default.anake.hcs localhost;
index index.php index.htm index.html;
root /var/www/nginx-default/;
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
#
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
location ~ .php$ {
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
#
# pass phpmyadmin/??? to /usr/share/phpmyadmin/???
#
location ~ ^/phpmyadmin/.*.php$ {
root /usr/share;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
# handle missing /
location = /phpmyadmin {
rewrite ^ /phpmyadmin/ redirect;
}
location /phpmyadmin/ {
root /usr/share;
index index.php;
}
}

[email protected]:/etc/nginx/sites-enabled$

All the other sites are listen 80. I’m browsing it from another local
machine
via default.anake.hcs daomin name.

[email protected]:/etc/nginx$ cat fastcgi_params
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_index index.php;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;
[email protected]:/etc/nginx$
[email protected]:/etc/nginx$ cat nginx.conf
user www-data www-data;
worker_processes 2;

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

events {
worker_connections 512;
}

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

 default_type  application/octet-stream;

 access_log      /var/log/nginx/access.log;
 index  index.php index.html index.htm;
 sendfile        on;
 keepalive_timeout  5;
 tcp_nodelay        on;
 gzip  on;
 include /etc/nginx/sites-enabled/*[a-zA-Z];

}
[email protected]:/etc/nginx$

To summarise the results
/ OK - serves index.html
/test.php OK - passed to fastcgi.
/phpmyadmin No input file specified. (and the URL
changes to /phpmyadmin/
/phpmyadmin/index.php No input file specified.

This config appears to me to be correct, yet it is not working.
Anyone?

Regards

Ian

On 23/07/2010 10:04, Edho P Arief wrote:

move it to bottom

Thanks. Works a treat!

Regards

Ian

On Fri, Jul 23, 2010 at 3:28 PM, Ian H. [email protected] wrote:

Hi All,

Found what was happening but I don’t know how to fix it.

if I remove the clause starting  "location ~ .php$ { "  then phpmyadmin
works.

How can I stop it firing when the URL does NOT contain “phpmyadmin” ???

move it to bottom


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs