nginx代理mysql,ssh

nginx代理mysql,ssh

  • 查看nginx信息 nginx -V,下载相同版本nginx解压并编译
  • configure编译时追加参数--with-stream,执行make命令
  • 备份原来nginx可执行文件,复制objs目录的nginx文件,到nginx sbin 目录
  • 配置 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

nginx代理mysql,ssh

原文:https://www.cnblogs.com/stringfade/p/15246501.html

以上是nginx代理mysql,ssh的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>