如何解决nginx 代理通过 TCP 389
我们有一个“OpenLDAP”服务器,端口 389 当前处于活动状态,我们希望使用 nginx 将此 TCP 端口 389 代理传递到基于 TCP 的入口。任何人都可以为此分享 nginx.conf 详细信息。
到目前为止,还没有完成,如下所示,
upstream rtmp_servers {
server acme.example.com:389;
}
server {
listen 389;
server_name localhost:389;
proxy_pass rtmp_servers;
proxy_protocol on;
}
遇到错误,感谢任何建议
2021/03/02 09:45:39 [emerg] 1#1:不允许使用“proxy_pass”指令 这里在 /etc/nginx/conf.d/nginx-auth-tunnel.conf:9 nginx: [emerg] 此处不允许使用“proxy_pass”指令 /etc/nginx/conf.d/nginx-auth-tunnel.conf:9
解决方法
- 您的配置应位于
stream
块中 - 你不需要
server_name localhost:389;
- 您正在包含
/etc/nginx/conf.d
文件夹中的配置,该文件夹包含在主 nginx.conf 文件中的 http 块中。 流块应与 http 块处于同一级别。检查/etc/nginx/nginx.conf
的include
,也许您必须为流部分添加一个
这是一个示例 nginx.conf,
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf; #This include is your problem
}
stream {
upstream rtmp_servers {
server acme.example.com:389;
}
server {
listen 389;
proxy_pass rtmp_servers;
proxy_protocol on;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。