Reputation: 2772
I am trying to implement "ssl_preread" in my nginx. My nginx is compiled with "--with-stream_ssl_preread_module" this module.
I mentioned "ssl_preread on;" in server directive of nginx.conf. But i am getting below error.
nginx: [emerg] "ssl_preread" directive is not allowed here in /opt/nginx/conf/nginx.conf:43
I am following below doc.
http://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html
Upvotes: 5
Views: 15593
Reputation: 2470
Perhaps this is a late answer. I had the following issue when installing nginx 1.14
from CentOS 8.3 repo.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] unknown "ssl_preread_server_name" variable\nnginx: configuration file /etc/nginx/nginx.conf test failed\n',)
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] unknown "ssl_preread_server_name" variable\nnginx: configuration file /etc/nginx/
nginx.conf test failed\n',)
I fixed it by upgrading the very latest nginx-1:1.20.0-1.el8.ngx.x86_64
, following this URL
http://nginx.org/en/linux_packages.html#RHEL-CentOS
Upvotes: 0
Reputation: 2139
Maybe U need to update Nginx to lastest version. 1.10 I meet this error too, but 1.18 the config is OK.
Upvotes: 0
Reputation: 1570
--with-stream
--with-stream_ssl_preread_module
stream { upstream app { server IP1:Port; server IP2:Port; } map $ssl_preread_server_name $upstream { default app; } server { listen PORT; ssl_preread on; proxy_pass $upstream; } }
This worked for me. Let me know if this works for you too
Upvotes: 4