【发布时间】:2011-01-27 22:44:37
【问题描述】:
我正在为 django 使用 apache+mod_wsgi。
并且所有 css/js/images 都通过 nginx 提供。
出于某种奇怪的原因,当其他人/朋友/同事尝试访问该站点时,jquery/css 没有为他们加载,因此页面看起来很混乱。
我的 html 文件使用这样的代码 -
<link rel="stylesheet" type="text/css" href="http://x.x.x.x:8000/css/custom.css"/>
<script type="text/javascript" src="http://1x.x.x.x:8000/js/custom.js"></script>
我在sites-available的nginx配置是这样的-
server {
listen 8000;
server_name localhost;
access_log /var/log/nginx/aa8000.access.log;
error_log /var/log/nginx/aa8000.error.log;
location / {
index index.html index.htm;
}
location /static/ {
autoindex on;
root /opt/aa/webroot/;
}
}
有一个目录/opt/aa/webroot/static/,有对应的css & js 目录。
奇怪的是,当我访问它们时页面显示正常。
我已经清除了我的缓存/等,但页面加载对我来说很好,可以从各种浏览器中加载。
另外,我在 nginx 日志文件中没有看到任何 404 错误。
任何指针都会很棒。
【问题讨论】:
-
我知道这可能很明显,但它不适合我,在你进行更改后运行:
sudo nginx -s reload这应该可以工作,它对我有用