ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

конфиг


  • To: nginx-ru@xxxxxxxxx
  • Subject: конфиг
  • From: "delphiworld" <nginx-forum@xxxxxxxx>
  • Date: Wed, 07 Sep 2011 08:15:14 -0400
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mickey.jlkhosting.com; s=x; h=Date:Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=Z3DlYtYqhpZjuVOyvfHQzDBQ7AIbpBBaXnhr3Pte5ss=; b=HlQLTFw502GxVr4ff1BpZr9QyxvFDosxtjGbviQbET4985IvpihGLHjxiFddIMdUTT3QjnTp4nh592Mao6S8isnqgXXyD94Jkw7dRCz1pv9CjQq5zvbRKT6avUsdRDMI;

настроил nginx на отдачу статики из
файлового кэша, указал expires, при
обновлении страницы f5 возвращает 304,
при переходе по ссылкам и возврате на
страницу все равно 200
вот конфиг:

user www;
worker_processes  1;
timer_resolution 100ms;
worker_priority -5;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
    use epoll;
}

http {
    include       /etc/nginx/mime.types;
    #limit_req_zone $binary_remote_addr zone=ddos:10m  rate=100r/s;
    access_log  /var/log/nginx/access.log;
    proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=default:1024m
inactive=1d max_size=1024m;
    #sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_buffers 4 8k;
    gzip_comp_level 4;
    gzip_http_version 1.1;
    gzip_proxied any;
    gzip_types text/html text/plain application/xml
application/x-javascript text/css;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    client_max_body_size 16m;
    #log_format  isp '$bytes_sent $request_length';
    server {
                listen 62.75.216.187:80;              
                server_name site.com combats2.com www.site.com www.combats2.com;
                error_page 404 /404.html;
                location /404.html {
                internal;
                }
                proxy_intercept_errors on;
                location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
                        proxy_pass http://62.75.216.187:8080;
                        proxy_redirect off;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location / {
                        #limit_req  zone=ddos burst=10;
                        proxy_pass http://62.75.216.187:8080;                   
    
                        proxy_redirect off;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location ~* ^.+\.(jpg|jpeg|gif|png|js|css|html)$ {
                        root /var/www/www/data/www/site.com;
                        access_log off;
                        expires 1d;
                        add_header Cache-Control public;
                        proxy_buffering on;
                        proxy_cache default; 
                        proxy_cache_valid  404 502 503 60m;
                        proxy_cache_valid  any 1d;
                }
        }
        server {
                listen 62.75.216.187:80;              
                server_name combats.site.com www.combats.site.com;
                rewrite ^(/manager/.*)$ https://$host$1 permanent;
                error_page 404 /404.html;
                location /404.html {
                internal;
                }
                proxy_intercept_errors on;
                location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
                        proxy_pass http://62.75.216.187:8080;
                        proxy_redirect http://combats.site.com:8080/ /;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location / {
                        #limit_req  zone=ddos burst=10;
                        proxy_pass http://62.75.216.187:8080;
                        proxy_redirect http://combats.site.com:8080/ /;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location ~* ^.+\.(jpg|jpeg|gif|png|js|css|html)$ {
                        root /var/www/www/data/www/combats.site.com;
                        access_log off;
                        expires 3d;
                        add_header Cache-Control public;
                        proxy_buffering on;
                        proxy_cache default; 
                        proxy_cache_valid  404 502 503 60m;
                        proxy_cache_valid  any 1d;
                }
        }
        server {
                listen 62.75.216.187:80;
                #proxy_buffering on;
                #proxy_cache default;      
                #proxy_cache_valid  404 502 503 60m;
                #proxy_cache_valid  any 1d;
                server_name img.site.com www.img.site.com;
                rewrite ^(/manager/.*)$ https://$host$1 permanent;
                error_page 404 /404.html;
                location /404.html {
                internal;
                }
                proxy_intercept_errors on;
                location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
                        proxy_pass http://62.75.216.187:8080;
                        proxy_redirect http://img.site.com:8080/ /;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location / {
                        #limit_req  zone=ddos burst=10;
                        proxy_pass http://62.75.216.187:8080;
                        proxy_redirect http://img.site.com:8080/ /;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location  ~* ^.+\.(jpg|jpeg|gif|png|js|css|html)$ {
                        root /var/www/www/data/www/img.site.com;
                        access_log off;
                        expires 3d;
                        add_header Cache-Control public;                
     
                }
                  proxy_buffering on;
                        proxy_cache default; 
                        proxy_cache_valid  404 502 503 60m;
                        proxy_cache_valid  any 1d;
        }

}
не знаю насколько он правильный )

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?21,214947,214947#msg-214947

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.