The best configuration for serving static content

etrader nginx-forum at
Mon Dec 5 10:29:28 UTC 2011

I want to create a config for domains serving static content. I made the
following conf file. Is it the best possible code? (I just kept php
interpretation for possible usage)

	location ~*

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;
		access_log		off;
     location ~ \.(css|js|jpg|jpeg|png|gif)$ {
    expires 31536000s;
    add_header Pragma public;
    add_header Cache-Control public;
     location ~ \.php$ {
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
    include /etc/nginx/fastcgi_params;

Posted at Nginx Forum:,219622,219622#msg-219622

More information about the nginx mailing list