社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
将本机的6033端口转发至本机3306
# yum -y install maridb* nginx
设置selinux为宽松模式
# setenforce 0
# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
# systemct start maridb
# systemct enable maridb
# mysql_secure_installation
# vim /etc/nginx/nginx.conf
####################################################
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
stream {
proxy_timeout 30m;
server {
listen 192.168.1.104:6033;
proxy_pass 127.0.0.1:3306;
}
}
######################################################
# systemctl start nginx
# systemctl enable nginx
# systemctl status nginx
# mysql -u root -p"MySQL@123"
# mysql -u root -P 6033 -p"MySQL@123"
nginx启用stream日志配置文件
https://www.cnblogs.com/cheyunhua/p/8823496.html
利用nginx的stream模块实现内网端口的转发代理
https://blog.51cto.com/icenycmh/2117844
Module ngx_stream_core_module
http://nginx.org/en/docs/stream/ngx_stream_core_module.html
Nginx基于TCP/UDP端口的四层负载均衡(stream模块)配置梳理
https://cloud.tencent.com/developer/article/1027563
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!