-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
子目录的url与status该如何显示 #397
Comments
这个需要使用 njs 搭配 fancyindex,方可显示目录浏览内容。 请参考: |
我加入了njs模块但是启动nginx报错unknown directive "js_include",经过查找是在njs0.7.1中被js_import代替。 |
请改用:
请参考:#345 (comment) |
您好,你看到的问题是页面没有正确载入导致的。您可以直接用 curl 发出请求,并观察返回结果是否存在异常。 |
以下是返回的结果 C:\Users\Administrator>curl -s -v -X POST -H "text/html" http://10.1.10.111/blender/
* Trying 10.1.10.111:80...
* Connected to 10.1.10.111 (10.1.10.111) port 80 (#0)
> POST /blender/ HTTP/1.1
> Host: 10.1.10.111
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 403 Forbidden
< Server: nginx/1.24.0
< Date: Thu, 05 Oct 2023 00:08:47 GMT
< Content-Type: text/html
< Content-Length: 153
< Connection: keep-alive
<
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.24.0</center>
</body>
</html>
* Connection #0 to host 10.1.10.111 left intact |
找到原因了,是
中缺少.html |
这是我的nginx,conf
|
使用 POST 请求 nginx 的静态文件会得到 403 的返回码是正常现象,并无异常。 |
那该如何解决这个问题 |
您需要具体描述出现的问题。 |
网页子目录无法访问
|
这是nginx的错误日志
|
排查了一下,应该和 njs 0.8 之后 API 的变化有关。请帮忙测试以下补丁是否能工作 diff --git a/static/njs/fancy_index.njs b/static/njs/fancy_index.njs
index 17cc091..3b06615 100644
--- a/static/njs/fancy_index.njs
+++ b/static/njs/fancy_index.njs
@@ -9,7 +9,7 @@ function fancyIndexRender(r, templateUrl){
if(rTmpl.status != 200){
return r.return(rTmpl.status);
}
- var tmpl = rTmpl.responseBody;
+ var tmpl = rTmpl.responseText;
var result = Mark.up(tmpl, {
url: r.variables.request_uri.replace(/\/+/g, '/').replace(/\?.*$/, ''),
open: '{{',
diff --git a/static/njs/legacy_index.njs b/static/njs/legacy_index.njs
index 681f698..396ced3 100644
--- a/static/njs/legacy_index.njs
+++ b/static/njs/legacy_index.njs
@@ -24,7 +24,7 @@ function legacyIndexRender(r){
if(rTmpl.status != 200){
return r.return(rTmpl.status);
}
- var tmpl = rTmpl.responseBody;
+ var tmpl = rTmpl.responseText;
r.subrequest('/static/njs/options.json', {
args: '',
@@ -36,7 +36,7 @@ function legacyIndexRender(r){
}
var global_options;
try{
- global_options = JSON.parse(rOpt.responseBody);
+ global_options = JSON.parse(rOpt.responseText);
}catch(e){
return r.return(500);
}
@@ -58,7 +58,7 @@ function legacyIndexRender(r){
var mirs = unlisted;
if(rMirs.status == 200){
try{
- mirs = mirs.concat(JSON.parse(rMirs.responseBody));
+ mirs = mirs.concat(JSON.parse(rMirs.responseText));
}catch(e){
}
} |
您好,请问子目录的url与status该如何显示,我在html中找到了它们但不知该如何传入数据
The text was updated successfully, but these errors were encountered: