i'm trying to set up my own Stealth VPN server using NGINX 1.18 in Debian 11. I follow this guide but many of the directives are not working. The problem is when i issue nginx -t
test command the output is:
- nginx: [emerg] unknown "ssl_preread_server_name" variable
I changed this varaible from $ssl_preread_server_name
to $server_name
if the problem is only with this particular variable and to see if there are any other erros, the test has passed but found another variable error, this one:
- nginx: [emerg] unknown "name" variable`
Which is in my last server block of code in nginx.conf
file os i don't expect it to find any more errors. I checked the original datase of Nginx variables and the variable $name
and $ssl_preread_server_name
are official and exist. The guide i follow said they should be allocated like this and there are not any other guides on the internet so i'm kinda stuck.
So far i have just problem with those two variables. The are located in map
block and last server
block.
Thank you very much for your help
This is my whole code:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
##
# Servers
##
server {
# server_name 206.189.21.228;
listen 127.0.0.1:8000;
}
##
# map
##
map $ssl_preread_server_name $name {
default https;
206.189.21.228 vpn;
}
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
stream {
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
upstream https {
server unix:/etc/nginx/nginx_writing;
}
upstream vpn {
server unix:/etc/openvpn/openvpn_writing;
}
server {
listen unix:/etc/nginx/nginx_writing ssl;
# openvpn doesn't support unix-sockets
proxy_pass 127.0.0.1:1194;
}
server {
listen unix:/etc/nginx/nginx_writing2 ssl;
# could also use a unix-socket here
proxy_pass 127.0.0.1:8000;
}
server {
listen [::]:443 ipv6only=off;
proxy_protocol on;
proxy_pass $name;
}
}