<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}

h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}

h1 {
        color: #000000;
        font-size: 28pt;
}

h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}

h3 {
        font-size: 18px;
}

h4 {
        font-size: 16px;
}

h5 {
        font-size: 14px;
}

h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}

hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
    display: inherit;
}

p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}

a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}

#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}

button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}

code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}

code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}

pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}

pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}

#ws { background-color: #f8f8f8; }


.bloop_markdown table {
border-collapse: collapse;  
font-family: Helvetica, arial, freesans, clean, sans-serif;  
color: rgb(51, 51, 51);  
font-size: 15px; line-height: 25px;
padding: 0; }

.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
     
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }

.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }

.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }

.bloop_markdown blockquote{
  border-left: 4px solid #dddddd;
  padding: 0 15px;
  color: #777777; }
  blockquote > :first-child {
    margin-top: 0; }
  blockquote > :last-child {
    margin-bottom: 0; }

code, pre, #ws, #message {
    word-break: normal;
    word-wrap: normal;
}

hr {
    display: inherit;
}

.bloop_markdown :first-child {
    -webkit-margin-before: 0;
}

code, pre, #ws, #message {
    font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}


.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap:break-word"><div class="bloop_markdown"><p>Hi!</p>

<p>For using the ngx.balancer, <a href="https://github.com/openresty/lua-resty-core">lua-resty-core</a> is necessary.</p>

<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <br> <div id="bloop_sign_1509068477939204096" class="bloop_sign"></div> <br><p class="airmail_on">On 27 October 2017 at 01:21:43, rnmx18 (<a href="mailto:nginx-forum@forum.nginx.org">nginx-forum@forum.nginx.org</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>Hi,
<br>
<br>I am getting the following error when I try to use balancer_by_lua with
<br>ngx.balancer in my NGINX configuration.
<br>
<br>2017/10/26 08:13:38 [error] 22447#22447: *10 failed to run balancer_by_lua*:
<br>balancer_by_lua:2: module 'ngx.balancer' not found:
<br>        no field package.preload['ngx.balancer']
<br>        no file '/home/rajesh/lua-resty-http-master/lib/ngx/balancer.lua'
<br>        no file
<br>'/home/rajesh/lua-resty-balancer-master/lib/ngx/balancer.lua'
<br>        no file './ngx/balancer.lua'
<br>        no file '/usr/local/share/luajit-2.0.5/ngx/balancer.lua'
<br>        no file '/usr/local/share/lua/5.1/ngx/balancer.lua'
<br>        no file '/usr/local/share/lua/5.1/ngx/balancer/init.lua'
<br>        no file '/home/rajesh/lua-resty-balancer-master/ngx/balancer.so'
<br>        no file './ngx/balancer.so'
<br>        no file '/usr/local/lib/lua/5.1/ngx/balancer.so'
<br>        no file '/usr/local/lib/lua/5.1/loadall.so'
<br>        no file '/home/rajesh/lua-resty-balancer-master/ngx.so'
<br>        no file './ngx.so'
<br>        no file '/usr/local/lib/lua/5.1/ngx.so'
<br>        no file '/usr/local/lib/lua/5.1/loadall.so'
<br>stack traceback:
<br>        [C]: in function 'require'
<br>        balancer_by_lua:2: in function <balancer_by_lua:1> while connecting
<br>to upstream, client: 192.168.1.3, server: <a href="http://myserver.com">myserver.com</a>, request: "GET
<br>/images/6314.jpeg HTTP/1.1"
<br>
<br>
<br>The upstream config snippet is as follows:
<br>    upstream backends {
<br>        server 0.0.0.1;
<br>        balancer_by_lua_block {
<br>            local b = require "ngx.balancer"
<br>            .....
<br>
<br>
<br>[root@localhost rajesh]# /usr/sbin/nginx -V
<br>nginx version: nginx/1.12.1
<br>built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)  
<br>built with OpenSSL 1.0.2l  25 May 2017
<br>TLS SNI support enabled
<br>configure arguments: --prefix=/etc/nginx --with-openssl-opt=-fPIC
<br>--with-openssl=/home/rajesh/nginx_prod_build_test/openssl-1.0.2l
<br>--sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules
<br>--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
<br>--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
<br>--lock-path=/var/run/lock/subsys/nginx --user=nginx --group=nginx
<br>--with-http_ssl_module --with-http_realip_module --with-http_addition_module
<br>--with-http_sub_module --with-http_dav_module --with-http_flv_module
<br>--with-http_mp4_module --with-http_gunzip_module
<br>--with-http_gzip_static_module --with-http_random_index_module
<br>--with-http_secure_link_module --with-http_degradation_module
<br>--with-http_slice_module --with-http_stub_status_module
<br>--with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic
<br>--with-http_geoip_module=dynamic --with-http_perl_module=dynamic
<br>--with-threads --with-stream=dynamic --with-stream_ssl_module
<br>--with-http_auth_request_module --with-mail=dynamic --with-mail_ssl_module
<br>--with-file-aio --with-pcre --with-pcre-jit --with-google_perftools_module
<br>--with-http_v2_module
<br>--add-module=/home/rajesh/nginx_prod_build_test/headers-more-nginx-module-0.32
<br>--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
<br>-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
<br>-m64 -mtune=generic -O2 -fPIC -g -pipe -Wno-error -fstack-protector
<br>-std=c++11 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
<br>--param=ssp-buffer-size=4 -grecord-gcc-switches
<br>-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
<br>--with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
<br>-Wl,-E -Wl,-rpath,/usr/local/lib' --with-debug
<br>--add-module=/home/rajesh/nginx-upstream-carp-master
<br>--add-module=/home/rajesh/ngx_devel_kit-0.3.0
<br>--add-module=/home/rajesh/lua-nginx-module-0.10.11rc2
<br>
<br>Any inputs regarding the reason for this error, and how to resolve this?
<br>
<br>Thanks
<br>Rajesh
<br>
<br>Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,277076,277076#msg-277076">https://forum.nginx.org/read.php?2,277076,277076#msg-277076</a>
<br>
<br>_______________________________________________
<br>nginx mailing list
<br><a href="mailto:nginx@nginx.org">nginx@nginx.org</a>
<br><a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a>
<br></div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>