Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

NGINX will not serve CSS or JS files to the browser

Link to page (magento)

Access log shows:

[01/Dec/2013:16:55:17 +0000] "GET /js/varien/form.js HTTP/1.1" 304 0 "" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"

Error Log Shows no errors.

Following is my vhost file:

server {
listen       80 default_server;
root   /data/www/public_html/hotnstylish/public/;

#charset koi8-r;
access_log  /data/www/public_html/hotnstylish/log/access.log;
error_log /data/www/public_html/hotnstylish/log/error.log;

location / {
include /etc/nginx/mime.types;
    root   /data/www/public_html/hotnstylish/public/;
    index  index.html index.htm index.php;
    try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
    expires 30d; ## Assume all files are cachable


#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
# proxy the PHP scripts to Apache listening on
#location ~ \.php$ {
#    proxy_pass;

## These locations would be hidden by .htaccess normally
location ^~ /app/                { deny all; }
location ^~ /includes/           { deny all; }
location ^~ /lib/                { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/            { deny all; }
location ^~ /report/config.xml   { deny all; }
location ^~ /var/                { deny all; }

# media
location ~* \.(png|gif|jpg|jpeg|css|js|swf|ico)$ {
    root   /data/www/public_html/hotnstylish/public/;
    access_log off;
    expires 30d;

# pass the PHP scripts to FastCGI server listening on
  location ~ ^/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
  location /var/export/ { internal; }
  location /. { return 404; }
  location @handler { rewrite / /index.php; }
  location ~* .php/ { rewrite ^(.*.php)/ $1 last; }
  location ~* .php$ {
if (!-e $request_filename) { rewrite / /index.php last; }
expires off;
root           /data/www/public_html/hotnstylish/public/;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#location ~ /\.ht {
#    deny  all;

My Mime types in /etc/nginx/:

types {
text/html                             html htm shtml;
text/css                              css;
text/xml                              xml;
image/gif                             gif;
image/jpeg                            jpeg jpg;
application/x-javascript              js;
application/atom+xml                  atom;
application/rss+xml                   rss;

Please help taken way too long to solve this one! Thanks

share|improve this question
up vote 3 down vote accepted

Clear your browser cache.

304 means "Not Modified" and instructs the browser to serve its cached copy.

share|improve this answer
Dude your a saint i hadnt a clue especially as i was incognito. Thanks so much! that did it for me... – user179181 Dec 1 '13 at 17:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.