Welcome! Log In Create A New Profile

Advanced

Re: Помогите переписать .htaccess

September 01, 2010 05:58AM
On Tue, Aug 31, 2010 at 06:23:55PM -0400, maxya wrote:

> Путем научного тыка обнаружил
> конфликт
> [code]
> location ^~ /lin/ {
> rewrite
> ^/lin/line_(.*)_beg_(.*)_wmax_(.*)_wcur_(.*)_wmin(.*)\.jpg$
> /lin/img.php?line=$1&beg=$2&wmax=$3&wcur=$4&wmin=$5 break;
> }
> [/code]
>
> И вот этого.
> [code]
> if (!-e $request_filename) {
> rewrite ^/(.*)$ /index.php?q=$1 last;
> }
> [/code]
>
> Сайт работает под управлением Drupal и
> второй кусок кода нужен для корректной
> работы чистых ссылок, однако, он не даёт
> выполняться 1й части кода.
> Обе части нужны, но 1-я должна
> выполняться только в sitename/lin/ первой.
> Посоветуйте как быть?
>
> Полный конфиг:
>
> [code]
> server {
> listen 80;
> server_name www.mysite.ru;
> rewrite ^/(.*) http://mysite.ru$1 permanent;
> }
>
> server {
> listen 80;
> server_name mysite.ru;
>
> access_log /var/log/nginx/maxya.access.log;
> error_log /var/log/nginx/maxya.error.log ;
>
> root /var/www/maxya;
> index index.php;
> #charset utf-8;
> gzip_static on;
> gzip on;
>
> # some images have no mime type
> default_type image/jpeg;
>
> location ^~ /lin/ {
> rewrite
> ^/lin/line_(.*)_beg_(.*)_wmax_(.*)_wcur_(.*)_wmin(.*)\.jpg$
> /lin/img.php?line=$1&beg=$2&wmax=$3&wcur=$4&wmin=$5 break;
> fastcgi_pass 127.0.0.1:9000;
> #fastcgi_index index.php;
> 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;
> }
> #без этого не работают "чистые ссылки"
> #if (!-e $request_filename) {
> #rewrite ^/(.*)$ /index.php?q=$1 last;
> #}
>
> error_page 404 index.php;
>
> # hide protected files
> 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 ~* imagecache {
> access_log off;
> expires 30d;
> try_files $uri @drupal;
> }
>
> location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|htm|html)$ {
> access_log off;
> expires 30d;
> }
>
> location @drupal {
> index index.php;
> if (!-e $request_filename) {
> rewrite ^/(.*)$ /index.php?q=$1 last;
> }
> }
> error_page 405 = @drupal;
>
> location ~ ^.+.php$ {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> 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;
> }
>
> }
>
> [/code]

# hide protected files
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 = /lin {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/maxya/lin/index.php;
fastcgi_param REQUEST_METHOD $request_method;
}

location = /lin/ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/maxya/lin/index.php;
fastcgi_param REQUEST_METHOD $request_method;
}

location ~ ^/lin/line_(.*)_beg_(.*)_wmax_(.*)_wcur_(.*)_wmin(.*)\.jpg$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/maxya/lin/img.php;
fastcgi_param QUERY_STRING line=$1&beg=$2&wmax=$3&wcur=$4&wmin=$5;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}

location ~* imagecache {
try_files $uri @drupal;
access_log off;
expires 30d;
}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|htm|html)$ {
try_files $uri @drupal;
access_log off;
expires 30d;
}

location ~ \.php$ {
try_files $uri @drupal;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/maxya$uri;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}

location @drupal {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/maxya/index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}


--
Игорь Сысоев
http://sysoev.ru

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

Помогите переписать .htaccess

maxya August 31, 2010 02:48PM

Re: Помогите переписать .htaccess

maxya August 31, 2010 04:50PM

Re: Помогите переписать .htaccess

maxya August 31, 2010 06:23PM

Re: Помогите переписать .htaccess

maxya August 31, 2010 06:57PM

Re: Помогите переписать .htaccess

big bond September 01, 2010 05:32AM

Re: Помогите переписать .htaccess

Igor Sysoev September 01, 2010 05:58AM

Re: Помогите переписать .htaccess

maxya September 01, 2010 02:54PM

Re: Помогите переписать .htaccess

Igor Sysoev September 01, 2010 03:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 47
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