Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Помогите переписать .htacc ess
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@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|