首先介绍一下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等代理的更多相关文章

  1. 从运维的角度分析使用阿里云数据库RDS的必要性--你不应该在阿里云上使用自建的MySQL/SQL Server/Oracle/PostgreSQL数据库

    开宗明义,你不应该在阿里云上使用自建的MySQL or SQL Server数据库,对了,还有Oracle or PostgreSQL数据库. 云数据库 RDS(Relational Database ...

  2. MySQL&SQL server&Oracle&Access&PostgreSQL数据库sql注入详解

    判断数据库的类型 当我们通过一些测试,发现存在SQL注入之后,首先要做的就是判断数据库的类型. 常用的数据库有MySQL.Access.SQLServer.Oracle.PostgreSQL.虽然绝大 ...

  3. SQL Server,Oracle,DB2索引建立语句的对比

    原文引至:http://jvortex.blog.163.com/blog/static/16961890020122141010878/ 我们知道,索引是用于加速数据库查询的数据库对象.原理就是减少 ...

  4. mysql/sql server和java之间的数据类型对应关系

    Mysql************************************当前列 ClassName ColumnType DisplaySize TypeName0: java.lang.I ...

  5. .net(C#数据库访问) Mysql,Sql server,Sqlite,Access四种数据库的连接方式

    便签记录Mysql,Sql server,Sqlite,Access四种数据库的简单连接方式 //using MySql.Data.MySqlClient; #region 执行简单SQL语句,使用M ...

  6. SQL Server 日志和代理的错误日志

    本文介绍的日志不是事务日志,而是SQL Server 日志和代理的错误日志,按照主体把错误日志分为SQL Server.SQL Server Agent.Database Mail,以及 Window ...

  7. JMeter配置JDBC测试SQL Server/MySQL/ORACLE

    一.配置SQL Server 1.下载sql驱动,将sqljdbc4.jar放到JMeter安装目录/lib下. 2.启动JMeter,右键添加->配置文件->JDBC Connectio ...

  8. 如何连接oracle,mysql, SQL Server数据库(Java版)

    先添加上连接oracle,MySQL的驱动路径和数据库连接URL: MySQL: final String DBDRIVER = "org.gjt.mm.mysql.Driver" ...

  9. 不同数据库oracle mysql SQL Server DB2 infomix sybase分页查询语句

    在不同数据库中的使用的分页查询语句: 当前页:currentpage 页大小:pagesize 1. Oracle数据库 select * from (select A.*,rownum rn fro ...

随机推荐

  1. ie浏览器的版本

    原文链接:https://www.cnblogs.com/XCWebLTE/archive/2017/06/15/7017338.html function IEVersion() { var use ...

  2. 数据恢复工具PhotoRec

    数据恢复工具PhotoRec PhotoRec是一款文件恢复工具.它可以从硬盘.光驱.记忆卡中恢复视频.文档.压缩包等文件.该工具绕开文件系统,采用文件特征码机制,直接进行底层数据扫描,尝试恢复文件. ...

  3. 【nodeJS爬虫】前端爬虫系列

    写这篇 blog 其实一开始我是拒绝的,因为爬虫爬的就是cnblog博客园.搞不好编辑看到了就把我的账号给封了:). 言归正传,前端同学可能向来对爬虫不是很感冒,觉得爬虫需要用偏后端的语言,诸如 ph ...

  4. Python中按值来获取指定的键

    转自: https://blog.csdn.net/Jerry_1126/article/details/87907162 Python字典中的键是唯一的,但不同的键可以对应同样的值,比如说uid,可 ...

  5. YUI Compressor JS和CSS压缩工具使用方式(使用前安装JDK)

    压缩测试: 选中 test.js, 执行右键菜单“Process with &YUICompressor”,会生成 test-min.js. 注意事项: 1. 需要安装 JDK >= 1 ...

  6. IT 产品 需求 痛点

    英文应该有个 汉语发音 标注 这样的平台软件.罗马音.

  7. C#获得窗口控件句柄

    /*整个Windows编程的基础.一个句柄是指使用的一个唯一的整数值,即一个4字节(64位程序中为8字节)长的数值,来标识应用程序中的不同对象和同类中的不同的实例,诸如,一个窗口,按钮,图标,滚动条, ...

  8. bzoj3693: 圆桌会议 二分图 hall定理

    目录 题目链接 题解 代码 题目链接 bzoj3693: 圆桌会议 题解 对与每个人构建二分,问题化为时候有一个匹配取了所有的人 Hall定理--对于任意的二分图G,G的两个部分为X={x1,x2,- ...

  9. 10.17 NOIP模拟赛

    目录 2018.10.17 NOIP模拟赛 A 咒语curse B 神光light(二分 DP) C 迷宫maze(次短路) 考试代码 B 2018.10.17 NOIP模拟赛 时间:1h15min( ...

  10. C# 添加动态属性

    1.ExpandoObject(System.Dynamic) 2.JObject(Newtonsoft.Json.Linq)