网站首页 > 技术教程 正文
实现过程:
1.安装nginx,stream模块默认不安装的,需要手动添加参数:–with-stream
2.nginx.conf 配置,参考说明:ngx_stream_core_module
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
.................
}
# tcp层转发的配置文件夹
include /etc/nginx/tcp.d/*.conf;
请注意,stream配置不能放到http内,即不能放到/etc/nginx/conf.d/,因为stream是通过tcp层转发,而不是http转发。
如配置在http内,启动nginx会报如下错误:
nginx: [emerg] "server" directive is not allowed here
3.在tcp.d下新建个oracle.conf文件,内容如下:
stream {
upstream oracle{
server 192.168.2.3:1521;
}
server {
listen 1234;#将192.168.2.3的1521端口转发到本机的1234端口
proxy_pass oracle;
}
}
4.重启nginx,plsql访问本机的1234端口就相当于连接192.168.2.3的1521端口。
猜你喜欢
- 2024-10-10 Nginx和Firewall都可以实现四层转发,你喜欢哪一个?
- 2024-10-10 nginx做转发时,带下划线字段的header内容丢失
- 2024-09-14 NGINX 应用性能优化指南(第二部分):反向代理缓冲
- 2024-09-14 10《Nginx 入门教程》Nginx 的反向代理(上)
- 2024-09-14 Kubernetes中如何转发请求到集群外?
- 2024-09-14 Nginx 全面攻略:动静分离、压缩、缓存、黑白名单、跨域、高可用
- 2024-09-14 Portainer实用教程Portainer如何使用 Nginx 容器实现端口转发?
- 2024-09-14 Nginx TCP代理转发和负载均衡(nginx代理tcp转http)
- 2024-09-14 记一次nginx无法转发到后端的问题
- 2024-09-14 Nginx的请求数据处理流程(nginx的请求数据处理流程是什么)
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)