Welcome! Log In Create A New Profile

Advanced

Re: If rewrite

No1
May 27, 2010 07:58AM
Эххххх.....Приведу полный конфиг.
До нужного момента идет описание еще нескольких серверов.
И вот он:
server {
listen 80;
server_name img.mydomain;
access_log /var/log/nginx/img.access.log main;

location / {
root /var/www/img;
index index.html index.htm;
if (-f $request_filename) {
break;
}
if ($http_referer ~ refer.ru) {
rewrite ^/images/books[\d]+/[\d]+/(small.jpg|big.jpg) /images/img1/0/img_$1 last;
}
rewrite ^/images/imgb[\d]+/[\d]+/(small.jpg|big.jpg) /index.php;
}


location /images/mail/ {
alias /var/www/img/images/;
if (-f $request_filename) {
break;
}
if ($http_referer ~ refer) {
rewrite ^/images/mail/img[\d]+/[\d]+/(small.jpg|big.jpg) /images/img1/0/img_$1 last;

}
rewrite ^/images/img[\d]+/[\d]+/(small.jpg|big.jpg) /index.php;
error_page 404 = /noimg;
}

location /images/ {
root /var/www/img;
if (-f $request_filename) {
break;
}
if ($http_referer ~ refer) {
rewrite ^/images/books[\d]+/[\d]+/(small.jpg|big.jpg) /images/img1/0/img_$1 last;

}
rewrite ^/images/img[\d]+/[\d]+/(small.jpg|big.jpg) /index.php;
error_page 404 = /noimg;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/img$fastcgi_script_name;
include fastcgi_params;
}



#error_page 404 /404.html;
error_page 404 /error404.php;
#location = /404.html {
# root /var/www/errorpages;
#}


error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}


# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one

location ~ /\.ht {
deny all;
}
# XXX Statistics
location = /ngst {
stub_status on;
access_log off;
allow 127.0.0.1 ;
allow mydomain ;
deny all;
}
location ~ ^/rrd/ {
root /var/www/_stats;
allow mydomain;
deny all;
}
#location /images/avatars/ {
# root /var/www/img;
# error_page 404 = /noimg;
#}
location = /noimg {
proxy_pass http://back-www.myback.ru;
}


location ~* \.(css|js)$ { #При таком расположений nginx запускается,иначе нет,но скрипты и стили не кешируются.
proxy_pass http://127.0.0.1; #Прописывая в локейшн \images\css\ (где непосредственно лежат сами стили и скрипты,все в порядке и работает.Так же и с локейшн описанным ниже.)
proxy_set_header Host mydomain;

proxy_cache ONE;
proxy_cache_valid 1d;
proxy_temp_path /var/spool/nginx/temp;

expires 1d;
add_header Last-Modified: $date_gmt;
add_header Cache-Control: public;
}

location ~* \.+small+(jpeg|png|gif)$ {
proxy_pass http://127.0.0.1;
proxy_set_header Host mydomain;

proxy_cache ONE;
proxy_cache_valid 1d;
proxy_temp_path /var/spool/nginx/temp;

expires 1d;
add_header Last-Modified: $date_gmt;
add_header Cache-Control: public;
}
}

После тоже идут описания нескольких серверов.

В документаций написано что файлы кэша складываются в моем случае /var/spool/nginx/cache и /temp.Их там нет и ничего не создается.Кеширование делаю для того чтобы снизить нагрузку на винты,прыгает очень часто до 99-100%,средняя нагрузка около 75-80%
Subject Author Posted

If rewrite

No1 May 25, 2010 07:06AM

Re: If rewrite

No1 May 26, 2010 03:45AM

Re: If rewrite

Daniel Podolsky May 26, 2010 04:34AM

Re: If rewrite

No1 May 26, 2010 09:47AM

Re: If rewrite

Igor Sysoev May 26, 2010 01:18PM

Re: If rewrite

No1 May 27, 2010 07:58AM

Re: If rewrite

Igor Sysoev May 27, 2010 08:36AM

Re: If rewrite

No1 May 27, 2010 10:08AM

Re: If rewrite

Igor Sysoev May 27, 2010 11:20AM

Re: If rewrite

Алферов Василий May 28, 2010 02:10AM

Re: If rewrite

No1 May 28, 2010 05:20AM

Re: If rewrite

No1 May 28, 2010 06:27AM

Re: If rewrite

No1 May 28, 2010 08:49AM

Re: If rewrite

Mikhail Mazursky May 28, 2010 05:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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