You're missing a backslash. So it will look like this: location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|srt|txt|swf)$ {access_log off;expires 30d;}