Welcome! Log In Create A New Profile

Advanced

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

Sören Reinecke
March 31, 2022 02:14PM
Hello NGINX community,

nginx gives me the error messages
- "js_import" is not allowed here
and
- "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
/etc/nginx/nginx.conf:15

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.


Cheers

Sören Reinecke

_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

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

Sören Reinecke March 31, 2022 02:14PM

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

Sergey A. Osokin March 31, 2022 02:56PM

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

Sören Reinecke March 31, 2022 03:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 64
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready