[emerg] "stream" directive is not allowed 怎么解哈,已经安装了模块

51次阅读

共计 1107 个字符,预计需要花费 3 分钟才能阅读完成。

安装的是 oneinstack
在 nginx.conf 插入 stream 代码的时候报错,
显示的是 "nginx: [emerg] "stream" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:86"
stream {
map $ssl_preread_server_name $backend_name {
test.domain.net trojan;
test1.domain.net web;
test2.domain.net web;
}
upstream trojan {
server 127.0.0.1:50443;
}
upstream web {
server 127.0.0.1:445;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
proxy_pass$backend_name;
ssl_preread on;
}
}复制代码
网上普遍反应是没有安装模块, 但似乎是装了的哈
nginx version: nginx/1.22.1
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1s1 Nov 2022
TLS SNI support enabled
configure arguments: –prefix=/usr/local/nginx –user=www –group=www –with-http_stub_status_module –with-http_sub_module –with-http_v2_module –with-http_ssl_module –with-stream –with-stream_ssl_preread_module –with-stream_ssl_module –with-http_gzip_static_module –with-http_realip_module –with-http_flv_module –with-http_mp4_module –with-openssl=../openssl-1.1.1s –with-pcre=../pcre-8.45 –with-pcre-jit –with-ld-opt=-ljemalloc
复制代码
感谢

3 楼说的什么屁东西,什么都宝塔 … 你 stream 块放错位置了 stream 要放在 http 之外,和 http 同级重装系统,然后用宝塔装 nginx 解决,楼主应该是 centos,用 yum 装的 nginx

正文完
 0