NGINX 不提供 CSS 和 JS

NGINX 不提供 CSS 和 JS

NGINX 不会向浏览器提供 CSS 或 JS 文件

链接至页面(magento)http://836237.vps-10.com/

访问日志显示:

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

错误日志没有显示错误。

以下是我的虚拟主机文件:

server {
listen       80 default_server;
server_name  836237.vps-10.com;
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 127.0.0.1:80
#
#location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
#}

## 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 127.0.0.1:9000
#
  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_pass 127.0.0.1:9000;
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;
#}
}    
}    

我的 /etc/nginx/ 中的 Mime 类型:

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;

请帮忙解决这个问题,花了太长时间!谢谢

答案1

清除浏览器缓存。

304 表示“未修改”,并指示浏览器提供其缓存副本。

相关内容