Welcome! Log In Create A New Profile

Advanced

Re: PHP below server root not served

nano
January 10, 2014 04:38AM
On 10/01/2014 7:58 AM, Francis Daly wrote:
>
> The suggestion is along the lines of:
>
> location ^~ /phpmyadmin/ {
> location ~ \.php$ {
> # config for php scripts to be fastcgi_pass'd elsewhere
> }
> # config for static files to be served directly
> }
>
> and then whatever other top-level location{} blocks that you want for
> the rest of the server config -- possibly include a "location /" and a
> "location ~ \.php$".
>

I have done some extensive testing, using the suggestions you and Jim
provided. In summary, the nesting of "location ~ \.php$" inside
"location ^~ /phpmyadmin/" does not work. The error logged is:

[error] 50038#0: *7541 FastCGI sent in stderr: "Primary script unknown"
while reading response header from upstream, client: clientIP, server:
domain.com, request: "GET /phpMyAdmin/ HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php-fpm.sock:", host: "domain.com"

No matter what variation I tried[0], that was the repeated result.

However, the nesting of "~ ^/phpMyAdmin/(.*\.php)$" inside "location ^~
/phpmyadmin/" does work. With everything else the same, this regular
expression works. See the current working configuration, making use of
your nesting advice:

location ^~ /phpmyadmin {
access_log off;
rewrite ^ /phpMyAdmin/ permanent;
}

location /phpMyAdmin {
root /usr/local/www;
index index.php index.html;

location ~ ^/phpMyAdmin/(.*\.php)$ {
root /usr/local/www/;
include conf.d/php-fpm;
}
}

The included php-fpm[1] file is provided below.

I do not know why your suggested regular expression does not work;
however, your advice to nest does work. Thank you very much for your
repeated efforts to help, it is very much appreciated.

I am interested as to why this is more efficient and considered better
practice than my former configuration[2]? Why the statement:
"DoNotUseAlias (unless necessary)"? My original working setup[2] got the
job done with only two location blocks. Your recommendations require
three and a rewrite. Does this not create more work for the server as
well as more lines of configuration?

Francis, Jim; thank you both very much for your help.


[0] example variations of your suggestions:
https://cloud.bsdbox.co/public.php?service=files&t=a5ea2a41797b5845cd5c2bc5864d012b

[1] conf.d/php-fpm:
https://cloud.bsdbox.co/public.php?service=files&t=146de37c0f8db547022e6a164c4d14fe

[2]
location /phpmyadmin {
alias /usr/local/www/phpMyAdmin/;
index index.php index.html;
}

location ~ ^/phpmyadmin/(.*\.php)$ {
root /usr/local/www/phpMyAdmin/;
fastcgi_pass unix:/var/run/php-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/local/www/phpMyAdmin/$1;
}
[3]

--
syn.bsdbox.co <- for dummies

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

SSL ciphers, disable or not to disable RC4?

Anonymous User January 09, 2014 04:30AM

Re: SSL ciphers, disable or not to disable RC4?

nano January 09, 2014 04:44AM

Re: SSL ciphers, disable or not to disable RC4?

Jeffrey Walton January 09, 2014 04:54AM

RE: SSL ciphers, disable or not to disable RC4?

Lukas Tribus January 09, 2014 04:54AM

Re: SSL ciphers, disable or not to disable RC4?

Jeffrey Walton January 09, 2014 05:06AM

PHP below server root not served

nano January 09, 2014 05:26AM

Re: PHP below server root not served

Richard Stanway January 09, 2014 05:30AM

Re: PHP below server root not served

nano January 09, 2014 05:34AM

Re: PHP below server root not served

Francis Daly January 09, 2014 05:56AM

Re: PHP below server root not served

nano January 09, 2014 06:46AM

Re: PHP below server root not served

nano January 09, 2014 07:42AM

Re: PHP below server root not served

B.R. January 09, 2014 08:00AM

Re: PHP below server root not served

nano January 09, 2014 08:52AM

Re: PHP below server root not served

Francis Daly January 09, 2014 04:00PM

Re: PHP below server root not served

nano January 09, 2014 10:08PM

Re: PHP below server root not served

Francis Daly January 10, 2014 04:38AM

Re: PHP below server root not served

nano January 10, 2014 06:40AM

Re: PHP below server root not served

Francis Daly January 10, 2014 10:36AM

Re: PHP below server root not served

nano January 12, 2014 05:28AM

Re: PHP below server root not served

Francis Daly January 14, 2014 05:14PM

Re: PHP below server root not served

Valentin V. Bartenev January 15, 2014 02:20PM

Re: PHP below server root not served

nano January 10, 2014 04:38AM

Re: PHP below server root not served

nano January 09, 2014 09:44AM

Re: PHP below server root not served

Jim Ohlstein January 09, 2014 12:14PM

Re: PHP below server root not served

nano January 09, 2014 12:30PM

Re: SSL ciphers, disable or not to disable RC4?

Axel January 12, 2014 12:44PM

Re: SSL ciphers, disable or not to disable RC4?

Darren Pilgrim January 12, 2014 02:10PM

Re: SSL ciphers, disable or not to disable RC4?

Axel January 13, 2014 04:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 48
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready