nginx proxypass TCP 389
nginx proxypass TCP 389
我们有一个端口 389 当前处于活动状态的“OpenLDAP”服务器,我们希望使用 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" directive is not allowed
here in /etc/nginx/conf.d/nginx-auth-tunnel.conf:9 nginx: [emerg]
"proxy_pass" directive is not allowed here in
/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;
}
}
我们有一个端口 389 当前处于活动状态的“OpenLDAP”服务器,我们希望使用 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" directive is not allowed here in /etc/nginx/conf.d/nginx-auth-tunnel.conf:9 nginx: [emerg] "proxy_pass" directive is not allowed here in /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;
}
}