BROWSER CACHING PROBLEM IN NGINX

i’ve searched through your forums and other people have had the same issue with enabling browser caching in nginx but i dont see any resolutions provided. The GZIP code worked fine and it was enabled after a nginx restart but when I add this code for browser caching

location ~* .(txt|xml|js)$ {

expires 8d;

}

location ~* .(css)$ {

expires 8d;

}

location ~* .(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$ {

expires 8d;

}

location ~* .(jpg|jpeg|png|gif|swf|webp)$ {

expires 8d;

}

nothing happens. Im able to restart nginx but i still receive that browser caching is disabled. i added the code inside

http { ….

server { inserted in here }

}

if i try to add server { location… } outside of http{ } i cant restart nginx and receive an error.

here’s the full code. thank you.

worker_processes 1;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

gzip on;

gzip_comp_level 5;

gzip_min_length 256;

gzip_types

application/atom+xml

application/javascript

application/json

application/rss+xml

application/vnd.ms-fontobject

application/x-font-ttf

application/x-javascript

application/x-web-app-manifest+json

application/xhtml+xml

application/xml

font/opentype

image/svg+xml

image/x-icon

text/css

text/plain

text/javascript

text/x-component;

gzip_disable “MSIE [1-6].(?!.*SV1)”;

server_tokens off;

client_max_body_size 5g;

include /etc/nginx/conf.d/*.conf;

server {

location ~* .(txt|xml|js)$ {

expires 8d;

}

location ~* .(css)$ {

expires 8d;

}

location ~* .(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$ {

expires 8d;

}

location ~* .(jpg|jpeg|png|gif|swf|webp)$ {

expires 8d;

}

}

}

include /etc/nginx/*global_params;