nginx使用stream反向代理mysql
2017-11-30 14:34
405 查看
参考:http://www.linuxidc.com/Linux/2017-03/142221.htm
nginx代理mysql
1、nginx版本至少1.9的版本,版本太低没有stream这个功能
2、下载nginx
# wget http://nginx.org/download/nginx-1.10.3.tar.gz
# tar xvf nginx-1.10.3.tar.gz
3、编译
# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module--with-stream --with-stream_ssl_module
# make
# make install
4、修改配置文件
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen 12345;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass 127.0.0.1:3306;
}
}
![](https://img-blog.csdn.net/20171130143244563?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvamlqaXVxaXU2NjQ2/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
5、启动nginx
# /usr/local/nginx/sbin/nginx
6、测试
nginx代理mysql
1、nginx版本至少1.9的版本,版本太低没有stream这个功能
2、下载nginx
# wget http://nginx.org/download/nginx-1.10.3.tar.gz
# tar xvf nginx-1.10.3.tar.gz
3、编译
# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module--with-stream --with-stream_ssl_module
# make
# make install
4、修改配置文件
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen 12345;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass 127.0.0.1:3306;
}
}
5、启动nginx
# /usr/local/nginx/sbin/nginx
6、测试
相关文章推荐
- nginx使用stream反向代理mysql
- IIS tomcat共用80端口解决一个IP多个域名:使用Nginx反向代理方式使两者兼容
- Nginx使用反向代理时Hessian411错误解决方案(转)
- 使用Nginx/Lighttpd/Squid作为反向代理服务器 - [技术笔记]
- Nginx 反向代理---- upstream 的使用
- centos 6.5 下使用nginx 反向代理 多个tornado
- 实例详解tomcat组件安装+Nginx反向代理tomcat+Apache使用mod_jk和mod_proxy反向代理和负载均衡 推荐
- 解决nginx使用proxy_pass反向代理时,cookie丢失的问题
- 最简单实现跨域的方法:使用nginx反向代理
- OpenERP的优化---使用Nginx反向代理
- 如何搭建web服务器 使用Nginx搭建反向代理服务器
- nginx 反向代理之使用特定目录和处理程序
- 使用Nginx反向代理tomcat服务器
- nginx反向代理tomcat集群达到负载均衡,同时使用proxy_cache做web缓存 推荐
- IIS tomcat共用80端口解决一个IP多个域名:使用Nginx反向代理方式使两者兼容
- 如何搭建web服务器 使用Nginx搭建反向代理服务器 .
- 烂泥:使用UPUPW的Nginx进行反向代理及反向代理IIS
- NodeJS on Nginx: 使用nginx反向代理处理静态页面
- IIS tomcat共用80端口解决一个IP多个域名:使用Nginx反向代理方式使两者兼容
- 如何搭建web服务器 使用Nginx搭建反向代理服务器