Re: Nginx 1.7.0: location @php

2014-06-05 Thread Reinis Rozitis
I'm sorry, I did not understood nothing. Can you provide an example of how 
to avoid repeating the php configuration through @php location?


As someone said in earlier mails you can always use include and put the 
repeating parts in seperate files.


For example put this into php.conf:

location ~ \.php$ {
   try_files $uri =404;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   fastcgi_pass fastcgi;
   fastcgi_param PATH_INFO $fastcgi_path_info;
   fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
   include fastcgi.conf;
}


And then your main config will look like:

location ^~ /alpha {
   auth_basic Restricted Access;
   auth_basic_user_file htpasswd;
   try_files $uri $uri/ /alpha/index.php?$uri$args;
   include php.conf;
}

location ^~ /beta {
   try_files $uri $uri/ /beta/index.php?$uri$args;
   include php.conf;
}

rr 


___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Nginx 1.7.0: location @php

2014-06-04 Thread TECK
support Wrote:
---
 yes.
 
 update and test
 
 02.06.2014 10:24, wishmaster пишет:
I have the same problem in my php-application. Admin folder is
 protected with auth_basic and the rest folders - without auth. I have
 not found any solution except code duplication for php location.

Can you please explain what to update and test? Is unclear.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250342,250654#msg-250654

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: Nginx 1.7.0: location @php

2014-06-04 Thread TECK
Jonathan Matthews Wrote:
---
 Fortunately, this being a *public* *mailing* *list*, and Francis
 (along with almost every other subscriber) giving his time, experience
 and opinions for free, you are definitely no worse off than when you
 started.
 
 Actually, however, you're demonstrably better off, as Francis has both
 attempted to help you go through the kind of troubleshooting process
 that will serve you well if you apply it (Message-ID
 20140525132809.gn16...@daoine.org) and ...
 
  I think what I asked is
  very clear and simple:
  How do I avoid repeating a segment of configuration code assigned to
 @php
  into various locations:
 
  he has given you the answer to this question - that you clearly
 thought you began by asking, but didn't. In Message-ID
 20140531112745.gz16...@daoine.org.
 
 HTH.

I'm sorry, I did not understood nothing. Can you provide an example of how
to avoid repeating the php configuration through @php location?
IMO the logic presented is clear: define a @php location and call it in
other locations with try_files, like explained into Nginx documentation. In
my case the end result is unexpected, the php file contents will be
downloaded, instead of being executed. This works:
http://pastie.org/private/5gkl1pti1co0onzhgb8jpg

This does not:
http://pastie.org/private/iuz58naozk6xo92ukqmwsg

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250342,250655#msg-250655

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re[2]: Nginx 1.7.0: location @php

2014-06-02 Thread wishmaster

 I have the same problem in my php-application. Admin folder is protected with 
auth_basic and the rest folders - without auth. I have not found any solution 
except code duplication for php location.
 

 --- Original message ---
 From: TECK nginx-fo...@nginx.us
 Date: 2 June 2014, 06:47:47
  


 Francis,
 
 We are going in circles without reaching a solution. I think what I asked is
 very clear and simple:
 How do I avoid repeating a segment of configuration code assigned to @php
 into various locations:
 location @php {
 try_files $uri =404;
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 fastcgi_pass fastcgi;
 fastcgi_param PATH_INFO $fastcgi_path_info;
 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
 include fastcgi.conf;
 }
 
 The above configuration will never change, regardless in what location is
 used:
 location ^~ /alpha {
 auth_basic Restricted Access;
 auth_basic_user_file htpasswd;
 try_files $uri $uri/ /alpha/index.php?$uri

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Nginx 1.7.0: location @php

2014-06-02 Thread support

yes.

update and test

02.06.2014 10:24, wishmaster пишет:

  I have the same problem in my php-application. Admin folder is protected with 
auth_basic and the rest folders - without auth. I have not found any solution 
except code duplication for php location.
  


  --- Original message ---
  From: TECK nginx-fo...@nginx.us
  Date: 2 June 2014, 06:47:47
   




Francis,

We are going in circles without reaching a solution. I think what I asked is
very clear and simple:
How do I avoid repeating a segment of configuration code assigned to @php
into various locations:
location @php {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass fastcgi;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
include fastcgi.conf;
}

The above configuration will never change, regardless in what location is
used:
location ^~ /alpha {
auth_basic Restricted Access;
auth_basic_user_file htpasswd;
try_files $uri $uri/ /alpha/index.php?$uri

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx



___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: Nginx 1.7.0: location @php

2014-06-02 Thread Jonathan Matthews
On 2 June 2014 04:47, TECK nginx-fo...@nginx.us wrote:
 Francis,

 We are going in circles without reaching a solution

Fortunately, this being a *public* *mailing* *list*, and Francis
(along with almost every other subscriber) giving his time, experience
and opinions for free, you are definitely no worse off than when you
started.

Actually, however, you're demonstrably better off, as Francis has both
attempted to help you go through the kind of troubleshooting process
that will serve you well if you apply it (Message-ID
20140525132809.gn16...@daoine.org) and ...

 I think what I asked is
 very clear and simple:
 How do I avoid repeating a segment of configuration code assigned to @php
 into various locations:

... he has given you the answer to this question - that you clearly
thought you began by asking, but didn't. In Message-ID
20140531112745.gz16...@daoine.org.

HTH.

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Nginx 1.7.0: location @php

2014-05-31 Thread TECK
Hi Francis,

 Answer #1: what does does not work mean?
When I process an URI request, it downloads the file instead of executing
the PHP code.

What I try to achieve is very simple, use @php as location to execute PHP
code instead of repeating it over and over in various locations. Here it is
a better example of a functional setup:
http://pastie.org/private/5gkl1pti1co0onzhgb8jpg

What I try to achieve is replace the location ~ \.php$ location contents
with @php ones so I only execute try_files:
http://pastie.org/private/iuz58naozk6xo92ukqmwsg

Regards,

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250342,250514#msg-250514

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Nginx 1.7.0: location @php

2014-05-31 Thread Francis Daly
On Sat, May 31, 2014 at 01:59:18AM -0400, TECK wrote:

Hi there,

  Answer #1: what does does not work mean?
 When I process an URI request, it downloads the file instead of executing
 the PHP code.

Perhaps the request that you made did not match the location blocks that
you showed?

That's the way I can get the specific unwanted response that you
report here.

 What I try to achieve is very simple, use @php as location to execute PHP
 code instead of repeating it over and over in various locations. Here it is
 a better example of a functional setup:
 http://pastie.org/private/5gkl1pti1co0onzhgb8jpg

If it matters to the question, can you include the (minimal) configuration
in the mail directly? That way, it will be available for the next person
who searches the archives.

Thanks.

I'm guessing that you may want something like

  try_files i-dislike-macro-include @php;

Good luck with it,

f
-- 
Francis Dalyfran...@daoine.org

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Nginx 1.7.0: location @php

2014-05-31 Thread TECK
Francis,

 I'm guessing that you may want something like
 try_files i-dislike-macro-include @php;
What you posted is some deprecated configuration available on Google.

 Perhaps the request that you made did not match the location blocks that
you showed?
If that would be the case, the proper code posted earlier would not work, so
this is not the case. I'm very familiar with Nginx and I understand the
try_files concept very well. My original question was how to avoid repeating
a segment of configuration code endless times, more exactly this:
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass fastcgi;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
include fastcgi.conf;

Using logic and the examples provided into Nginx documentation what I posted
previously should work. Can you provide a solution to my question?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250342,250517#msg-250517

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Nginx 1.7.0: location @php

2014-05-25 Thread TECK
Hi all,

I'm trying to understand why the use of this configuration code does not
work:
location ^~ /setup {
auth_basic  Restricted Access;
auth_basic_user_filehtpasswd;
try_files   $uri $uri/ /setup/index.php?$uri$args;
location ~ \.php$ {
try_files   @php =404;
}
}
location @php {
try_files   $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_passfastcgi;
fastcgi_param   PATH_INFO   $fastcgi_path_info;
fastcgi_param   PATH_TRANSLATED
$document_root$fastcgi_script_name;
include fastcgi.conf;
}

This works:
location ^~ /setup {
auth_basic  Restricted Access;
auth_basic_user_filehtpasswd;
try_files   $uri $uri/ /setup/index.php?$uri$args;
location ~ \.php$ {
try_files   $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_passfastcgi;
fastcgi_param   PATH_INFO   $fastcgi_path_info;
fastcgi_param   PATH_TRANSLATED
$document_root$fastcgi_script_name;
include fastcgi.conf;
}
}

Thank you for your help.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250342,250342#msg-250342

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Nginx 1.7.0: location @php

2014-05-25 Thread Francis Daly
On Sun, May 25, 2014 at 05:49:33AM -0400, TECK wrote:

Hi there,

 I'm trying to understand why the use of this configuration code does not
 work:

Answer #1: what does does not work mean?

What request do you make; what response do you get; what response do
you want?

   try_files   @php =404;

Answer #2: what do you think that directive does? What does the
documentation say that that directive does? Hint: the final argument to
try_files is uri or =code. All of the other ones are file.

f
-- 
Francis Dalyfran...@daoine.org

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx