Show all posts by user
Discussions in Russian
I think handling sessions and authentication/authorization in PHP is better suitable in your case. Once the user has been authenticated via your PHP backend, you can use header "X-Accel-Redirect" (see: http://wiki.nginx.org/XSendfile) and internal locations, to allow access to such locations upon any criteria of your choice, because you do it in PHP. These locations will not be availab
by
locojohn
-
How to...
Maxim Dounin Wrote:
-------------------------------------------------------
> Если под данный location нужны
> свои специальные fastcgi_param -
> нужно их все определить в
> данном location'е. Или
> переосмыслить
> конфигурацию и сделать так,
> чтобы годил
by
locojohn
-
Nginx Mailing List - Russian
В дополнение, GEOIP_* параметры FastCGI также не передаются, если находятся в блоке server {}, а не в блоке location, обеспечивающим работу php скриптов.
Андрей
by
locojohn
-
Nginx Mailing List - Russian
Уважаемый Игорь,
Я устанавливаю переменную FastCGI окружения PHP_VALUE в значение "include_path=$document_root" в server {} блоке, чтобы PHP-FPM backend находил нужные файлы в include_path равном $document_root:
server {
listen 80;
server_name test.com
by
locojohn
-
Nginx Mailing List - Russian
Andrey Repin Wrote:
-------------------------------------------------------
> Насколько я понимаю,
> параметры fastcgi_pass
> наследуются, и в
> интерпретатор
> передаётся последний.
> Создайте блок с самыми
> общими пареметрами (два
> блока, для и
by
locojohn
-
Nginx Mailing List - Russian
If I understood you correctly:
server {
server_name ~^(?<subdomain>.+)\.test\.com$;
if (!-d /home/test/public/subdomain/$subdomain) {
rewrite ^ http://test.com/?page=$subdomain$request_uri? last;
}
root /home/test/public/subdomain/$subdomain;
index index.php;
location ~ \.php$ {
include fastcgi_params;
by
locojohn
-
How to...
Denis F. Latypoff Wrote:
-------------------------------------------------------
> 10.11.2011, 04:12, "valet" <nginx-forum@nginx.us>:
> > То есть повторить кусок с
> location ~ \.php$ { в
> > другом локейшене:
> > Это у меня такой немалый
> кусок :), будет
Вот и у меня
by
locojohn
-
Nginx Mailing List - Russian
slurpderp Wrote:
-------------------------------------------------------
> I want http://domain/?subtopic=herp&derp=this to
> rewrite to http://domain/herp/derp/this
>
if ($args ~ subtopic=(?<subtopic>[^&]+)&derp=(?<derp>[^&]*)) {
rewrite ^ /$subtopic/derp/$derp? last;
}
Put the above into your server {} configuration (do not put it into locati
by
locojohn
-
How to...
Patschi Wrote:
-------------------------------------------------------
> What do you exactly mean with 2)?
When the link argument of the URL itself contains query string arguments like:
http://yourserver/encode?http://test.com/?arg1=val1&arg2=val2&5
You might have a hard time parsing/getting the link itself (http://test.com/?arg1=val1&arg2=val2, that is).
Andrejs
by
locojohn
-
How to...
Hi,
rewrite ^/encode?(.*)(&[1-9]+)$ /encode.php?q=$1&s=$2 last;
rewrite ^/decode?(.*)$ /decode.php?q=$1 last;
It's a bad idea, because: 1) you are forced to use "rewrite"s and "if"s; and 2) your links that you specify as an argument to encode/decode may contain query parameters, and they would mix with q= & s= parameters during the rewrite. but ok:
by
locojohn
-
How to...
siloan Wrote:
-------------------------------------------------------
> Ok but now the hole link is shown in the browser
> like http://mydomain.com/doc1/index.php?d=1
Maybe this:
rewrite ^/doc\d+/?$ /doc/index.php?d=$1 last;
Andrejs
by
locojohn
-
How to...
siloan Wrote:
-------------------------------------------------------
> Great man, thanks! 2 more questions:
> 1.How to restrict only .php files in that way.
> 2.I have a rewrite
> rewrite ^/doc([0-9]+)$ /doc/index.php?d=$1 last;
> mydomain.com/doc1 is working but if the link has a
> ending slash like mydomain.com/doc1/ is not
> working anymore, why ?
because in y
by
locojohn
-
How to...
Hi
Not sure I understood what you meant by " it is following the "Main" server setting of httpd/conf/httpd.conf ". Are you running Apache as the backend server?
Please post your nginx.conf.
Andrejs
by
locojohn
-
How to...
Hi,
Maybe try to move index command into your location / block:
location / {
proxy_pass http://127.0.0.1:8080;
index index.html index.php;
}
I'd also move root command into your main server configuration block.
server {
...
root /home/mydomain.ltd/public_html;
...
}
by
locojohn
-
How to...
Hi,
try:
location ~ /doc\d+/inc/file\.php {
deny all;
}
and put it as a sub-location into your \.php location handler.
Andrejs
by
locojohn
-
How to...
If I understood you correctly, the below should work:
# match any url that does not contain "."
location ~ ^[^.]+$ {
# if the request is a filename, just issue 403 Forbidden
if (-f $request_filename) {
return 403;
}
# otherwise, it's a
by
locojohn
-
How to...
Make sure the following is set in php.ini:
cgi.fix_pathinfo = 1
Please attach your full nginx.conf as it is now, if possible.
Andrejs
by
locojohn
-
How to...
Well, it doesn't work because you have an older version of PCRE library:
http://nginx.org/en/docs/http/server_names.html says:
The PCRE library supports named captures using the following syntax:
?<name> Perl 5.10 compatible syntax, supported since PCRE-7.0
?'name' Perl 5.10 compatible syntax, supported since PCRE-7.0
?P<name> Python compatible syntax, supported since PCRE-4
by
locojohn
-
How to...
Sorry, it should have been:
# handle URLs like: "/path/to/myscript.php"
location ~ ^(?<script_name>.+\.php)$ {
try_files $script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$script_name;
fastcgi_pass unix:/tmp/php5-fpm-hom.sock;
}
# handle URLs like: "/path/to/myscript.php/with/path/info"
location ~ ^(?<script_name&
by
locojohn
-
How to...
nginx version?
pcre library version? install the latest.
Andrejs
by
locojohn
-
How to...
RVN Wrote:
-------------------------------------------------------
> By any chance did you try changing:
>
> location ~ ^.+\.php$ {
> include
> fastcgi_params;
> fastcgi_intercept_errors
> on;
> fastcgi_pass
> unix:/tmp/php.socket;
> }
>
by
locojohn
-
Migration from Other Servers
Hi,
try this:
# handle URLs like: "/path/to/myscript.php"
location ~ ^(?<script_name?>.+\.php)$ {
try_files $script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$script_name;
fastcgi_pass 127.0.0.1:9000;
}
# handle URLs like: "/path/to/myscript.php/with/path/info"
location ~ ^(?<script_name?>.+\.php)(?<path_i
by
locojohn
-
How to...
Nginx User Wrote:
-------------------------------------------------------
> Adding Maxim's statement above into account,
> outside a location block,
> "break" behaves just like "last" does since there
> are no location
> directives to run here.
>
> Someone just needs to update the docs if this is
> correct.
>
I have experienced situat
by
locojohn
-
Nginx Mailing List - English
Не могу. Я говорю о ситуациях, когда директивы разные даже внутри одного виртуального хоста для разных locations и одного стандартного файла быть не может. Я говорю о сайтах с веб-аппликациями, использующими различные framewor
by
locojohn
-
Nginx Mailing List - Russian
Hi!
Arguments cannot be checked with location directive. Put the below code into your main server {} block, for example, before declaring any of the locations:
if ($request_uri ~ ^/index\.php\?PageID=1$) {
rewrite ^ /? permanent;
}
Andrejs
by
locojohn
-
Nginx Mailing List - English
try_files $uri $1page.php?page=$2&$args;
Andrejs
by
locojohn
-
How to...
Привет!
Возникла проблема со сложными сайтами (виртуальными хостами), для которых не хочется создавать несколько конфигурационных файлов из-за необходимости включения одних и тех же директив, связанными, например, с
by
locojohn
-
Nginx Mailing List - Russian
Glad it worked. Just noticed a small thing about the "\.php" vs ".php" as "." means any character in PCRE:
location ~ (.*/)(+)\.php {
Also, suggest to shorten it a bit for nicety:
location ~ (.*/)([\w\-\.]+)\.php {
Andrejs
by
locojohn
-
How to...