How to install njs after building from sources

Mustafa Aldemir mustafa at aldemir.net
Thu Aug 9 09:34:36 UTC 2018


Hello Dmitry,

I followed the guides. To build njs:

*./configure --with-compat*
*make*

To build and install NGINX:

*./auto/configure --sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module
--with-pcre=../pcre-8.41 --with-zlib=../zlib-1.2.11 --with-stream
--with-stream_ssl_module --with-stream_ssl_preread_module  --with-compat
--add-dynamic-module=/home/ubuntu/patched/njs/nginx --with-debug*

*make modules*
*make*
*sudo make install*


Then, I put a configuration and Javascript file which work well with a
pre-built installation.

When I start NGINX, I get an error:

nginx: [emerg] failed to create JS VM in /usr/local/nginx/nginx.conf:14

The 14th line of nginx.conf is:

    js_include mqtt.js;

bye,
mustafa

nginx.conf:


*worker_processes  1;*
*error_log  /var/log/nginx/error.log warn;*
*pid        /var/run/nginx.pid;*

*load_module modules/ngx_stream_js_module.so;*

*events {*
*    worker_connections  1024;*
*}*

*stream {*
*    js_include mqtt.js;*
*    js_set     $mqtt_client_id setClientId;*

*    upstream awsiot {*
*        server iot.us-east-1.amazonaws.com:8883
<http://iot.us-east-1.amazonaws.com:8883>;*
*        hash $mqtt_client_id consistent;*
*    }*
*    log_format mqtt '$remote_addr [$time_local] $protocol $status
$bytes_received'*
*                '$bytes_sent $upstream_addr $mqtt_client_id'; # Include
MQTT ClientId*
*    server {*
*        listen 1883;*
*        preread_buffer_size 1k; # Big enough to read CONNECT packet header*
*        tcp_nodelay on;*
*        js_preread getClientId; # Parse CONNECT packet for ClientId*
*        js_filter filter;*

*        proxy_pass awsiot;*
*        proxy_ssl on;*
*        proxy_ssl_certificate     nginx-as-client.pem;*
*        proxy_ssl_certificate_key nginx-as-client.key;*
*        proxy_ssl_trusted_certificate root-ca-for-awsiot.pem;*
*        proxy_ssl_verify off;*
*        proxy_ssl_session_reuse off;*

*        access_log /var/log/nginx/mqtt_access.log mqtt;*
*        error_log  /var/log/nginx/mqtt_error.log debug;*
*    }*
*}*



On Wed, Aug 8, 2018 at 4:11 PM, Dmitry Volyntsev <xeioex at nginx.com> wrote:

>
>
> On 08.08.2018 17:06, Mustafa Aldemir wrote:
>
>> Hello,
>>
>> I built NGINX and njs from sources. Now I have njs executable and some
>> static object files under ~/njs/build.
>>
>> How should I install njs or configure NGINX to run with njs?
>>
>
>
> Hi Mustafa,
>
> Please, use the instruction from here
> http://nginx.org/en/docs/njs_about.html#install_sources
>
>
>
>
>
>> regards,
>> mustafa
>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>>


-- 
Mustafa Aldemir,
http://mustafa.aldemir.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180809/70254e1f/attachment.html>


More information about the nginx mailing list