nginx代理mysql,ssh
时间:2021-09-10 00:59:59
收藏:0
阅读:27
nginx代理mysql,ssh
- 查看nginx信息
nginx -V,下载相同版本nginx解压并编译 configure编译时追加参数--with-stream,执行make命令- 备份原来
nginx可执行文件,复制objs目录的nginx文件,到nginxsbin目录 - 配置
nginx.conf, 与http模块同级
stream {
upstream mysqlstream {
server 127.0.0.1:3306;
}
server {
listen 13306;#可自定义
proxy_connect_timeout 10s;
proxy_timeout 300s;
proxy_pass mysqlstream;
}
}
stream {
upstream sshstream {
server 127.0.0.1:22;
}
server {
listen 10022;#可自定义
proxy_connect_timeout 10s;
proxy_timeout 300s;
proxy_pass sshstream;
}
}
## 打开防火墙
iptables -I INPUT -p tcp --dport 13306 -j ACCEPT
iptables -I INPUT -p tcp --dport 10022 -j ACCEPT
原文:https://www.cnblogs.com/stringfade/p/15246501.html
评论(0)