无法在自定义nginx错误页面中加载静态文件

时间:2017-10-11 17:41:00

标签: nginx

我有以下静态文件:

/home/nginx/js/a.js
/home/nginx/errors/403.html

nginx.conf

[...]
location / {
    root /home/nginx;
}

error_page 403 /errors/403.html;

location = /errors/403.html {
    root /home/nginx;
}
[...]

403.html代码:

[...]
<script src="js/a.js"></script>
[...]

但是它会导致错误,无法找到想要的.js文件。 我尝试使用../js/a.js更改它,将403.html移动到根目录(nginx.conf's location中的更改)但仍无效果。这是nginx配置的问题吗?

0 个答案:

没有答案