Nginx配置WebService、MySQL、SQL Server、ORACLE等代理
首先介绍一下Nginx的基本使用:
注意不要直接双击nginx.exe,这样会导致修改配置后重启、停止nginx无效,需要手动关闭任务管理器内的所有nginx进程
在nginx.exe目录,打开命令行工具,用命令 启动/关闭/重启nginx
start nginx : 启动nginx
nginx -s reload :修改配置后重新加载生效
nginx -s reopen :重新打开日志文件
nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确
关闭nginx:
nginx -s stop :快速停止nginx
nginx -s quit :完整有序的停止nginx
如果遇到报错:
bash: nginx: command not found
有可能是你再linux命令行环境下运行了windows命令,
如果你之前是允许 nginx -s reload报错, 试下 ./nginx -s reload
或者 用windows系统自带命令行工具运行
nginx配置webservice
#user nobody;
worker_processes 4; #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;
} http {
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; upstream esbServer {
server 127.0.0.1:8083 weight=1 max_fails=2 fail_timeout=30s;
} #gzip on; server {
listen 8081;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /ladder_web {
proxy_set_header X-real-ip $remote_addr;
proxy_pass http://esbServer;
} } }
nginx 配置mysql代理 -- 基于nginx1.9以上 stream module
stream 模块用于一般的 TCP 代理和负载均衡。
#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 {
upstream sql {
server 172.16.10.229:3306 weight=1 max_fails=2 fail_timeout=30s;
} server {
listen 3333;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass sql;
}
}
nginx配置Sql server服务代理
#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 { upstream sqlserver {
server 172.16.10.167:1433 weight=1 max_fails=2 fail_timeout=30s;
} server {
listen 3334;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass sqlserver;
}
}
nginx配置Oracle代理
#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 { upstream oracle {
server 172.16.10.222:1521 weight=1 max_fails=2 fail_timeout=30s;
} server {
listen 3335;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass oracle;
}
}
Nginx配置WebService、MySQL、SQL Server、ORACLE等代理的更多相关文章
- 从运维的角度分析使用阿里云数据库RDS的必要性--你不应该在阿里云上使用自建的MySQL/SQL Server/Oracle/PostgreSQL数据库
开宗明义,你不应该在阿里云上使用自建的MySQL or SQL Server数据库,对了,还有Oracle or PostgreSQL数据库. 云数据库 RDS(Relational Database ...
- MySQL&SQL server&Oracle&Access&PostgreSQL数据库sql注入详解
判断数据库的类型 当我们通过一些测试,发现存在SQL注入之后,首先要做的就是判断数据库的类型. 常用的数据库有MySQL.Access.SQLServer.Oracle.PostgreSQL.虽然绝大 ...
- SQL Server,Oracle,DB2索引建立语句的对比
原文引至:http://jvortex.blog.163.com/blog/static/16961890020122141010878/ 我们知道,索引是用于加速数据库查询的数据库对象.原理就是减少 ...
- mysql/sql server和java之间的数据类型对应关系
Mysql************************************当前列 ClassName ColumnType DisplaySize TypeName0: java.lang.I ...
- .net(C#数据库访问) Mysql,Sql server,Sqlite,Access四种数据库的连接方式
便签记录Mysql,Sql server,Sqlite,Access四种数据库的简单连接方式 //using MySql.Data.MySqlClient; #region 执行简单SQL语句,使用M ...
- SQL Server 日志和代理的错误日志
本文介绍的日志不是事务日志,而是SQL Server 日志和代理的错误日志,按照主体把错误日志分为SQL Server.SQL Server Agent.Database Mail,以及 Window ...
- JMeter配置JDBC测试SQL Server/MySQL/ORACLE
一.配置SQL Server 1.下载sql驱动,将sqljdbc4.jar放到JMeter安装目录/lib下. 2.启动JMeter,右键添加->配置文件->JDBC Connectio ...
- 如何连接oracle,mysql, SQL Server数据库(Java版)
先添加上连接oracle,MySQL的驱动路径和数据库连接URL: MySQL: final String DBDRIVER = "org.gjt.mm.mysql.Driver" ...
- 不同数据库oracle mysql SQL Server DB2 infomix sybase分页查询语句
在不同数据库中的使用的分页查询语句: 当前页:currentpage 页大小:pagesize 1. Oracle数据库 select * from (select A.*,rownum rn fro ...
随机推荐
- 前端解读面向切面编程(AOP)
前言 面向对象(OOP)作为经典的设计范式,对于我们来说可谓无人不知,还记得我们入行起始时那句经典的总结吗-万事万物皆对象. 是的,基于OOP思想封装.继承.多态的特点,我们会自然而然的遵循模块化.组 ...
- Python中的MySQLConnector使用介绍
MySQL Connector/Python 是 MySQL 官方提供的 Python 连接 MySQL 数据库的驱动程序了,很多初学者对于 在python中连接mysql数据库还是有点为难了,下文我 ...
- 2016年3月11日Android学习日记
1.调试技巧:当一次调试过后,可以在App重新返回当前的状态,然后再调试,而不用再点击Android studio的Debug按钮. 参考:http://www.2cto.com/kf/201506/ ...
- 打包maven后出现jar包丢失
http://blog.csdn.net/asdfsfsdgdfgh/article/details/51373222
- iptables防火墙企业级模板
目前公司业务已大多迁移至内网使用或者使用云主机,防火墙也渐渐不用了,在博客上记录一下,以免以后突然有用却找不到模板了.此防火墙脚本执行时默认清空旧的防火墙规则.放行本地loop网卡,DNS服务,NTF ...
- Qt 4.6.2静态编译
一.下载mingw 4.4.0:ftp://ftp.trolltech.com/misc/MinGW-gcc440_1.zip 二.解压到C:\mingw目录下,设置环境变量path将C:\mingw ...
- Simple PWM to Analog Circuit (0-10vdc)
i just finished this simple circuit and am very satisfied with the result. The output is very stable ...
- Java 多线程(七) 线程间的通信——wait及notify方法
线程间的相互作用 线程间的相互作用:线程之间需要一些协调通信,来共同完成一件任务. Object类中相关的方法有两个notify方法和三个wait方法: http://docs.oracle.com/ ...
- CAP:Alantany 谈 CAP
引用Alantany的话:“CAP理论提出就是针对分布式数据库环境的,所以,P这个属性是必须具备的.P就是在分布式环境中,由于网络的问题可能导致某个节点和其它节点失去联系,这时候就形成了P(parti ...
- Java LinkedList工作原理及实现
1. 概述 以双向链表实现.链表无容量限制,但双向链表本身使用了更多空间,也需要额外的链表指针操作. 按下标访问元素—get(i)/set(i,e) 要悲剧的遍历链表将指针移动到位(如果i>数组 ...