V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
jsjcjsjc
V2EX  ›  NGINX

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

  •  
  •   jsjcjsjc · 2022-12-21 11:09:09 +08:00 · 1722 次点击
    这是一个创建于 489 天前的主题,其中的信息可能已经有所发展或是发生改变。

    安装的是 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.1s  1 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
    
    

    感谢

    4 条回复    2022-12-22 16:05:34 +08:00
    julyclyde
        1
    julyclyde  
       2022-12-21 11:20:48 +08:00   ❤️ 1
    你的 stream 是不是放到 http 内了?
    msg7086
        2
    msg7086  
       2022-12-21 11:52:31 +08:00   ❤️ 1
    stream 段插错地方了。
    zhoudaiyu
        3
    zhoudaiyu  
       2022-12-21 20:04:29 +08:00   ❤️ 1
    stream 是在根这一层的,和什么 http 、events 是一个层级的,检查下配置文件吧
    jsjcjsjc
        4
    jsjcjsjc  
    OP
       2022-12-22 16:05:34 +08:00
    @julyclyde
    @msg7086
    @zhoudaiyu 感谢,是我眼瞎了,笔记上都写了还是忘了~~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3228 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 14:17 · PVG 22:17 · LAX 07:17 · JFK 10:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.