Re: кеширование элементов дизайна

bioargonaft nginx-forum at nginx.us
Tue Jan 15 13:37:56 UTC 2013


Реализовал задачу.
Вот такие конфиги получились:

#===========> nginx.conf <=============================================
user  nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log warn; #debug;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
'
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    proxy_cache_path /var/cache/nginx/proxy_cache levels=1:2
keys_zone=static:32m inactive=15h max_size=64m;
    proxy_temp_path /var/cache/nginx/proxy_temp 1 2;
    proxy_ignore_headers Expires Cache-Control;
    proxy_cache_bypass $cookie_session;
    proxy_no_cache $cookie_session;

    sendfile       on;
    tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;
    gzip_static         on;
    gzip_proxied        any;
    gzip_min_length     1100;
    gzip_http_version   1.1;
    gzip_buffers        4 8k;
    gzip_comp_level     5;
    gzip_types          text/plain text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript
application/json;

    include /etc/nginx/conf.d/*.conf;
}
#===========> nginx.conf <=============================================



#===========> default.conf <=============================================
server {
    listen       80;
    server_name  localhost;

     if ( $scheme = "http" ) {
	      rewrite ^/(.*)$	https://$host/$1 permanent;
        }
}
#===========> default.conf <=============================================



#===========> ssl.conf <=============================================
# HTTPS server
server {
    listen       443;
    server_name  localhost;
    
    ssl                  on;
    ssl_certificate      /etc/nginx/ssl/cert.pem;
    ssl_certificate_key  /etc/nginx/ssl/cert.key;

    ssl_session_timeout  5m;

    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    location ~^/domjs/ {
    root /var/www/;
    }

    location ~^/.*\.(css|js|gif|jpg|png)$ {
    proxy_pass   http://192.168.1.250:8080;
    proxy_set_header Host $host;
    proxy_cache static;
    proxy_cache_valid 60m;
    #proxy_cache_valid 404 1m;
    expires 5d;
    }

    location / {
    proxy_pass   http://192.168.1.250:8080;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size 10m;
    client_body_buffer_size 128k;
    proxy_connect_timeout 90;
    proxy_send_timeout 90;
    proxy_read_timeout 90;
    proxy_buffer_size 4k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    proxy_ignore_client_abort on;
    }
}
#===========> ssl.conf <=============================================

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



Подробная информация о списке рассылки nginx-ru