Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker 获取:未知指令“;js“进口”;当njs与Nginx一起使用时_Docker_Nginx_Docker Compose_Nginx Reverse Proxy - Fatal编程技术网

Docker 获取:未知指令“;js“进口”;当njs与Nginx一起使用时

Docker 获取:未知指令“;js“进口”;当njs与Nginx一起使用时,docker,nginx,docker-compose,nginx-reverse-proxy,Docker,Nginx,Docker Compose,Nginx Reverse Proxy,我在Nginx conf中发表以下声明: js_import http.js; 但它似乎给了我未知指令“js\u import” 我已验证是否安装了njs。我似乎可以进入cli。njs的版本是0.3.9 下面的语句似乎起作用了,是placehttpblock: js_include http.js js_content hello 这似乎也起作用,并放在http块内的server块中: js_include http.js js_content hello Nginx似乎是最新版本 我

我在Nginx conf中发表以下声明:

js_import http.js;
但它似乎给了我
未知指令“js\u import”

我已验证是否安装了njs。我似乎可以进入cli。njs的版本是0.3.9

下面的语句似乎起作用了,是place
http
block:

js_include http.js
js_content hello
这似乎也起作用,并放在
http
块内的
server
块中:

js_include http.js
js_content hello
Nginx似乎是最新版本

我似乎找不到我在这里缺少的东西

非常感谢您的帮助。

阅读和放置

load_module/usr/lib/nginx/modules/ngx_http_js_module.so

在我的
nginx.conf
的顶部,您可能需要这样写


load_modules modules/ngx_http_js_module.so

验证您使用的是最新的nginx版本或ngx_http_js_模块版本js_import,如文档中所述,ngx_http_js_模块v0.4.0附带在哪里?仅允许在
http
stream
块中使用。我将其放置在http块中。我也有同样的问题,我复制并粘贴了文档中的示例。load_模块指令在那里,模块文件存在。。。(来自docker的nginx 1.17.5)感谢您的评论。我已经提到了load_modules/ngx_http_js_module.so;在顶端。它仍然不起作用。我已经编辑了问题,请检查。是的,我编辑了。我尝试使用不存在的路径来验证这一点。