nginx as the load balance use upstream_fair

55 views
Skip to first unread message

PstreeM China

unread,
Feb 16, 2021, 9:36:17 AM2/16/21
to freebsd-...@freebsd.org
hello expert:

need your help for this issue, from the google can not find any
similar case.
use freebsd 12.2 system. and install nginx by ports, the version
is:nginx-1.18.0_47,2

configuration the fair as the load balance policy, but there is some
mistake when i start the service like:
===============
root@env:/usr/local/etc/nginx # service nginx onerestart
Performing sanity check on nginx configuration:
nginx: [emerg] "fair" directive is not allowed here in
/usr/local/etc/nginx/nginx.conf:35
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
===============

then,test if cancel the config "#fair", it running well.
===============
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
==============

search from google and read the guide from nginx official site, the example
configure is all like this. i don't know how to fix this ? thanks very
much for your help.

the part of configuration as below:
---------------------
load_module /usr/local/libexec/nginx/ngx_stream_module.so;
load_module /usr/local/libexec/nginx/ngx_http_dynamic_upstream_module.so;
load_module /usr/local/libexec/nginx/ngx_http_upstream_fair_module.so;
load_module /usr/local/libexec/nginx/ngx_http_sticky_module.so;

stream {

upstream backend {
server server1:443;
server server2:443;
server server3:443;
fair;
}

server {
listen 4443;
proxy_pass backend;

}
}
-------------------------

BR//Armin
_______________________________________________
freebsd-...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

PstreeM China

unread,
Feb 16, 2021, 11:20:52 AM2/16/21
to Karl Young, freebsd-...@freebsd.org
Hello:

Thanks for your quick response.

Yes.
The reason for install nginx by ports is to enable the fair module.
And double check , the 4 file which I loaded is there.

> load_module /usr/local/libexec/nginx/ngx_stream_module.so;
> load_module /usr/local/libexec/nginx/ngx_http_dynamic_upstream_module.so;
> load_module /usr/local/libexec/nginx/ngx_http_upstream_fair_module.so;
> load_module /usr/local/libexec/nginx/ngx_http_sticky_module.so;



On Wed, Feb 17, 2021 at 00:13 Karl Young <ka...@kipshouse.org> wrote:

> PstreeM
>
> Did you enable the HTTP_UPSTREAM_FAIR option when you installed the
> port?
>
>
> HTTP_UPSTREAM_FAIR=off: 3rd party upstream fair module
>
> Does this file exist?
>
> /usr/local/libexec/nginx/ngx_http_upstream_fair_module.so
>
> Regards,
>
> -karl
>
> PstreeM China(pst...@gmail.com)@2021.02.16 22:35:55 +0800:

Karl Young

unread,
Feb 16, 2021, 2:39:54 PM2/16/21
to PstreeM China, freebsd-...@freebsd.org
PstreeM

Did you enable the HTTP_UPSTREAM_FAIR option when you installed the
port?


HTTP_UPSTREAM_FAIR=off: 3rd party upstream fair module

Does this file exist?

/usr/local/libexec/nginx/ngx_http_upstream_fair_module.so

Regards,

-karl

PstreeM China(pst...@gmail.com)@2021.02.16 22:35:55 +0800:

Karl Young

unread,
Feb 17, 2021, 12:26:05 AM2/17/21
to PstreeM China, freebsd-...@freebsd.org
PstreeM

I'm afraid that's all I have. Maybe worth asking on some nginx list.

-karl

PstreeM China(pst...@gmail.com)@2021.02.17 00:20:29 +0800:
Reply all
Reply to author
Forward
0 new messages