<div dir="ltr"><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hello Dmitry,</span><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px">I followed the guides. To build </span>njs<span style="font-size:12.8px">:</span><br><br><div style="font-size:12.8px"><i>./configure --with-compat</i></div><div style="font-size:12.8px"><i>make</i></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">To build and install NGINX:</div><div style="font-size:12.8px"><br></div><div><div><span style="font-size:12.8px"><i>./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</i></span></div><div><i><span style="font-size:12.8px">make modules</span><br></i></div><div><span style="font-size:12.8px"><i>make</i></span></div><div><span style="font-size:12.8px"><i>sudo make install</i></span></div></div><div style="font-size:12.8px"><br></div></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">Then, I put a <span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">configuration and Javascript file which work well with a pre-built installation.</span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">When I start NGINX, I get an error:<br><br><span></span><p class="gmail-m_1613768786922144934gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(244,244,244);background-color:rgb(0,0,0)"><span class="gmail-m_1613768786922144934gmail-s1" style="font-variant-ligatures:no-common-ligatures">nginx: [emerg] failed to create JS VM in /usr/local/nginx/nginx.conf:14</span></p><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">The 14th line of nginx.conf is:</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br><span></span><p class="gmail-m_1613768786922144934gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(244,244,244);background-color:rgb(0,0,0)"><span class="gmail-m_1613768786922144934gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_1613768786922144934gmail-Apple-converted-space"> <span> </span></span>js_include mqtt.js;</span></p></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">bye,</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">mustafa</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">nginx.conf:</div><div style="text-decoration-style:initial;text-decoration-color:initial"><div><span style="font-size:12.8px"><br></span></div><div><i><span style="font-size:12.8px">worker_processes 1;</span><span style="font-size:12.8px"><br></span></i></div><div><span style="font-size:12.8px"><i>error_log /var/log/nginx/error.log warn;</i></span></div><div><span style="font-size:12.8px"><i>pid /var/run/nginx.pid;</i></span></div><div><span style="font-size:12.8px"><i><br></i></span></div><div><span style="font-size:12.8px"><i>load_module modules/ngx_stream_js_module.so;</i></span></div><div><span style="font-size:12.8px"><i><br></i></span></div><div><span style="font-size:12.8px"><i>events {</i></span></div><div><span style="font-size:12.8px"><i> worker_connections 1024;</i></span></div><div><span style="font-size:12.8px"><i>}</i></span></div><div><span style="font-size:12.8px"><i><br></i></span></div><div><span style="font-size:12.8px"><i>stream {</i></span></div><div><span style="font-size:12.8px"><i> js_include mqtt.js;</i></span></div><div><span style="font-size:12.8px"><i> js_set $mqtt_client_id setClientId;</i></span></div><div><span style="font-size:12.8px"><i><br></i></span></div><div><span style="font-size:12.8px"><i> upstream awsiot {</i></span></div><div><span style="font-size:12.8px"><i> server <a href="http://iot.us-east-1.amazonaws.com:8883">iot.us-east-1.amazonaws.com:8883</a>;</i></span></div><div><span style="font-size:12.8px"><i> hash $mqtt_client_id consistent;</i></span></div><div><span style="font-size:12.8px"><i> }</i></span></div><div><span style="font-size:12.8px"><i> log_format mqtt '$remote_addr [$time_local] $protocol $status $bytes_received'</i></span></div><div><span style="font-size:12.8px"><i> '$bytes_sent $upstream_addr $mqtt_client_id'; # Include MQTT ClientId</i></span></div><div><span style="font-size:12.8px"><i> server {</i></span></div><div><span style="font-size:12.8px"><i> listen 1883;</i></span></div><div><span style="font-size:12.8px"><i> preread_buffer_size 1k; # Big enough to read CONNECT packet header</i></span></div><div><span style="font-size:12.8px"><i> tcp_nodelay on;</i></span></div><div><span style="font-size:12.8px"><i> js_preread getClientId; # Parse CONNECT packet for ClientId</i></span></div><div><span style="font-size:12.8px"><i> js_filter filter;</i></span></div><div><span style="font-size:12.8px"><i><br></i></span></div><div><span style="font-size:12.8px"><i> proxy_pass awsiot;</i></span></div><div><span style="font-size:12.8px"><i> proxy_ssl on;</i></span></div><div><span style="font-size:12.8px"><i> proxy_ssl_certificate nginx-as-client.pem;</i></span></div><div><span style="font-size:12.8px"><i> proxy_ssl_certificate_key nginx-as-client.key;</i></span></div><div><span style="font-size:12.8px"><i> proxy_ssl_trusted_certificate root-ca-for-awsiot.pem;</i></span></div><div><span style="font-size:12.8px"><i> proxy_ssl_verify off;</i></span></div><div><span style="font-size:12.8px"><i> proxy_ssl_session_reuse off;</i></span></div><div><span style="font-size:12.8px"><i><br></i></span></div><div><span style="font-size:12.8px"><i> access_log /var/log/nginx/mqtt_access.log mqtt;</i></span></div><div><span style="font-size:12.8px"><i> error_log /var/log/nginx/mqtt_error.log debug;</i></span></div><div><span style="font-size:12.8px"><i> }</i></span></div><div><span style="font-size:12.8px"><i>}</i></span></div><div style="font-size:12.8px"><br></div></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 8, 2018 at 4:11 PM, Dmitry Volyntsev <span dir="ltr"><<a href="mailto:xeioex@nginx.com" target="_blank">xeioex@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 08.08.2018 17:06, Mustafa Aldemir wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I built NGINX and njs from sources. Now I have njs executable and some static object files under ~/njs/build.<br>
<br>
How should I install njs or configure NGINX to run with njs?<br>
</blockquote>
<br>
<br></span>
Hi Mustafa,<br>
<br>
Please, use the instruction from here<br>
<a href="http://nginx.org/en/docs/njs_about.html#install_sources" rel="noreferrer" target="_blank">http://nginx.org/en/docs/njs_a<wbr>bout.html#install_sources</a><br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
regards,<br>
mustafa<br>
<br>
<br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailm<wbr>an/listinfo/nginx</a><br>
<br>
</blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font face="trebuchet ms, sans-serif">Mustafa Aldemir,</font><div><font face="trebuchet ms, sans-serif"><a href="http://mustafa.aldemir.net" target="_blank">http://mustafa.aldemir.net</a></font></div></div></div>
</div>