"js_import" is not allowed here, "js_content" is unknown

Sören Reinecke soeren.reinecke at trufi-association.org
Thu Mar 31 18:09:25 UTC 2022

Hello NGINX community,

nginx gives me the error messages
- "js_import" is not allowed here
- "js_content" is unknown

and don't know what I did wrong.

I have the following NGINX config at '/etc/nginx/nginx.conf'

load_module modules/ngx_stream_js_module.so;

user    nginx;

worker_processes    auto;

error_log    /var/log/nginx/error.log notice;

pid    /var/run/nginx.pid;

events {

     worker_connections  1024;


http {

     #js_path inc/js;

     js_import http.js ;


     include    /etc/nginx/mime.types;

     default_type    application/octet-stream;

     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                       '$status $body_bytes_sent "$http_referer" '

                       '"$http_user_agent" "$http_x_forwarded_for"';

     access_log  /var/log/nginx/access.log  main;

     sendfile        on;

     #tcp_nopush     on;

     keepalive_timeout  65;

     #gzip  on;

     include /etc/nginx/conf.d/*.conf;


. NGINX complains about `js_import`

[emerg] 1#1: "js_import" directive is not allowed here in 

and about

unknown directive "js_content" in /etc/nginx/conf.d/app.conf:7

The file '/etc/nginx/conf.d/app.conf' contains the following

server {

     listen 80;

     location /njs {

         js_content http.hello ;

#        root /var/www/html ;



I am using the docker image of NGINX.


Sören Reinecke

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220331/446b424d/attachment.htm>

More information about the nginx mailing list