Welcome! Log In Create A New Profile

Advanced

Re: nginx try_files & drupal

Vasiliy G Tolstov
October 09, 2009 07:56AM
В Птн, 09/10/2009 в 13:36 +0400, Igor Sysoev пишет:

> Такой вариант лучше:
>
> 1) идеологически,
> 2) немного быстрее - нет нового поиска location'а после rewrite'а и нет
> двух regex'ов - "rewrite ^/(.*)$" и "location ~ \.php$".
>
> В принципе, можно обойтись и без @drupal вообще:
> try_files $uri $uri/ /index.php?q=$uri&$args;
>
>


Странно, но с таким вариантов не работает теперь image_cache модуль:

первый атач - по конфигу вида:
1.conf (1.log)

второй по другому конфигу:
2.conf (2.log)

Есть ли какой-то вариант заставить try_files сработать и в этом случае?

--
Vasiliy G Tolstov <v.tolstov@selfip.ru>
Selfip.Ru
server {
listen 80;
server_name www.iul4a.ru;

root /home/iul4a/www/iul4a.ru;

access_log /home/iul4a/logs/iul4a.ru/access_log main;
error_log /home/iul4a/logs/iul4a.ru/error_log warn;

if ($http_host ~ "^blog.(.*)") {
set $name $1;
rewrite ^/(.*) http://$name/blog/$1;
}

if ($http_host ~ "^selfip.spb.ru") {
rewrite ^/(.*) http://selfip.ru/$1;
}

if ($http_host ~ "^www.(.*)") {
set $name $1;
rewrite ^/(.*) http://$name/$1;
}

location ~ /\.ht {
deny all;
break;
}

location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
expires 31d;
add_header Last-Modified: $date_gmt;
#break;
}

location "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$" {
deny all;
}


location ~ "^/(CHANGELOG|COPYRIGHT|INSTALL\.mysql|INSTALL\.pgsql|INSTALL|LICENSE|MAINTAINERS|UPGRADE)\.txt" {
deny all;
}

index index.php;
fastcgi_index index.php;

location / {
try_files $uri $uri/ @drupal;
}



location ~ \.php$ {
try_files $uri @drupal;
fastcgi_pass unix:/var/run/php/iul4a.ru;
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 SCRIPT_FILENAME $document_root$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;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

}

location @drupal {
fastcgi_pass unix:/var/run/php/iul4a.ru;
fastcgi_param QUERY_STRING q=$uri&$args;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $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;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

}

}

server {
listen 80;
server_name www.iul4a.ru;

root /home/iul4a/www/iul4a.ru;

access_log /home/iul4a/logs/iul4a.ru/access_log main;
error_log /home/iul4a/logs/iul4a.ru/error_log debug;

if ($http_host ~ "^www.(.*)") {
set $name $1;
rewrite ^/(.*) http://$name/$1;
}

location ~ /\.ht {
deny all;
break;
}

location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
expires 31d;
add_header Last-Modified: $date_gmt;
#break;
}


location "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$" {
deny all;
}


location ~ "/backup" {
deny all;
}

location ~ "^/(CHANGELOG|COPYRIGHT|INSTALL\.mysql|INSTALL\.pgsql|INSTALL|LICENSE|MAINTAINERS|UPGRADE)\.txt" {
deny all;
}

if ( !-e $request_filename ) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}

location ~ \.php$ {
fastcgi_pass unix:/var/run/php/iul4a.ru;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}



}
Subject Author Posted

nginx try_files & drupal

Vasiliy G Tolstov September 29, 2009 09:42AM

Re: nginx try_files & drupal

Vitaliy Lisenko October 08, 2009 02:12AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 08, 2009 02:56AM

Re: nginx try_files & drupal

Igor Sysoev October 08, 2009 03:04AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 08, 2009 03:48AM

Re: nginx try_files & drupal

Igor Sysoev October 08, 2009 03:16AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 08, 2009 04:00AM

Re: nginx try_files & drupal

Igor Sysoev October 08, 2009 04:24AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 08, 2009 05:04AM

Re: nginx try_files & drupal

Igor Sysoev October 08, 2009 08:12AM

Re: nginx try_files & drupal

Alexey V. Karagodov October 08, 2009 03:02PM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 08, 2009 06:22PM

Re: nginx try_files & drupal

Igor Sysoev October 08, 2009 03:24PM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 08, 2009 06:22PM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 01:40AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 02:28AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 02:44AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 03:18AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 03:30AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 04:22AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 04:50AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 05:40AM

Re[2]: nginx try_files & drupal

Denis F. Latypoff October 09, 2009 06:18AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 06:50AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 05:18AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 05:56AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 07:56AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 08:36AM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 09:54AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 10:10AM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 01:44PM

Re[2]: nginx try_files & drupal

Denis F. Latypoff October 09, 2009 02:24PM

Re: nginx try_files & drupal

Igor Sysoev October 09, 2009 02:44PM

Re: nginx try_files & drupal

Vasiliy G Tolstov October 09, 2009 03:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready