BROWSER CACHING Problem in NGINX

Hi!

When I try to paste the following code,

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;
}

just above http section in nginx.conf file it gives following error

nginx: [emerg] "location" directive is not allowed here in /etc/nginx/nginx.conf:16
nginx: configuration file /etc/nginx/nginx.conf test failed