首先介绍一下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. cookie和session、

    https://my.oschina.net/yoyo1987/blog/156117 Session会在浏览器关闭后消失吗? 通常情况下,当我们关闭浏览器再重新打开后,我们就需要再次进行登陆(如果没 ...

  2. Python字典中的值为列表或字典的构造方法

    转自: https://blog.csdn.net/buside/article/details/81323871 1.值为列表的构造方法 dic = {} dic.setdefault(key,[] ...

  3. 使用boost线程定时器作为后台线程来切换主循环程序状态方法2

    上一篇的方法主要使用的是:通过线程延时实 现的定时,并且只能定时一次,如果需要对此定时处理,就需要使用下面的定时器: #include "stdafx.h" #include &l ...

  4. [POI2018]Pionek

    [POI2018]Pionek 题目大意: 在无限大的二维平面的原点放置着一个棋子.你有\(n(n\le2\times10^5)\)条可用的移动指令,每条指令可以用一个二维整数向量表示.请你选取若干条 ...

  5. Saltstack 安装 命令

    主机规划 10.0.0.21 master 10.0.0.22 minion 10.0.0.23 minion 基础环境 [root@10.0.0.21 ~]# cat /etc/redhat-rel ...

  6. VMware workstation12 密匙

    VMware workstation12 密匙:5A02H-AU243-TZJ49-GTC7K-3C61N

  7. Linux学习笔记14—文件的压缩与打包

    1..gz   gzip 压缩工具压缩的文件 .bz2   bzip2 压缩工具压缩的文件 .tar   tar 打包程序打包的文件(tar并没有压缩功能,只是把一个目录合并成一个文件) .tar.g ...

  8. iOS11适配

    链接: 你可能需要为你的 APP 适配 iOS 11 iOS11新特性,如何适配iOS11 App界面适配iOS11(包括iPhoneX的奇葩尺寸) iOS 11 安全区域适配总结 iOS 11 sa ...

  9. java三大特性--继承

    定义: 继承就是子类继承父类的特征和行为,使得子类具有父类的各种属性和方法,使得子类具有父类相同的行为. 继承的好处: 有效实现代码复用,避免重复代码的出现. 让类与类之间产生了关系,是多态的前提. ...

  10. 使用BFG移除git库中的大文件或污点提交