My issue:
I want to use NGINX as a reverse proxy with SSL Passthrough (this is for an internal purpose and will not be exposed to the world).
I would like to be able to support a small number of different servers (using SNI?) but I’m nowhere near that at present.
I’m not familiar with NGINX so I’ve been relying on a number of internet “How To’s” but without success.
I understand that to use SSL Passthrough I need to configure NGINX in load balancing mode even though I’m only using one instance but, no matter what I do, I can’t seem to use the ‘stream’ directive.
I’ve got a very basic ‘nginx.conf’ (I’ve left the default server unchanged and it has these ‘includes’).
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
include /etc/nginx/conf.d/*.conf;
}
Based on one of the documents I’ve read I’ve created a new directory, /etc/nginx/tcpconf.d/ to make sure I don’t accidentally include the wrong thing in the ‘http’ section.
In that directory I have a basic config for a load balancer (example.conf):
upstream samplecluster {
server www.example.com:443;
}
server {
listen 443;
server_name www.example.com;
location / {
proxy_pass http://samplecluster/;
}
}
But no matter where I put the ‘stream’; at the end of nginx.conf, in example.conf, elswhere I always get the ‘unknown directive’ message:
sudo nginx -t
nginx: [emerg] unknown directive “stream” in /etc/nginx/nginx.conf:101
nginx: configuration file /etc/nginx/nginx.conf test failed
I checked that nginx had been compiled with the stream options:
nginx -V 2>&1 | grep -o with-stream
with-stream
with-stream
with-stream
Based on another document I installed nginx–mod-stream which created a conf file, and related ‘include’ to load the module but which caused the config to fail.
Obviously I’m not comprehending what I’m reading or I’m missing some basic assumption that will make this all clear.
All suggestions and clarifications welcome. Thanks.
How I encountered the problem:
Solutions I’ve tried:
Version of NGINX or NGINX adjacent software (e.g. NGINX Gateway Fabric):
1.20.1 on AlmaLinux 9.7
Deployment environment:
Minimal NGINX config to reproduce your issue (preferably running on https://tech-playground.com/playgrounds/nginx for ease of debugging, and if not as a code block): (Tip → Run nginx -T to print your entire NGINX config to your terminal.)
NGINX access/error log: (Tip → You can usually find the logs in the /var/log/nginx directory.)