nginx.conf

 #user  nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} 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 ;
keepalive_timeout ; #gzip on; #服务器的集群
upstream sqlserver1433{ #服务器集群名字 server 10.164.31.213:;#服务器配置 weight是权重的意思,权重越大,分配的概率越大。 } server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / {
# root html;
# index index.html index.htm;
# }
location / {
proxy_pass http://localhost;
proxy_redirect default;
index index.aspx;
#root C:\Website\demo1
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} } include stream01.conf;

nginx.conf

stream01.conf

 stream {
# 添加socket转发的代理
upstream num_socket01 {
hash $remote_addr consistent;
# 转发的目的地址和端口
server 10.164.31.213:;
} # 提供转发的服务,即访问localhost:,会跳转至代理bss_num_socket指定的转发地址
server {
listen ;
proxy_connect_timeout 10s;
proxy_timeout 10m;
proxy_pass num_socket01;
} upstream num_socket02 {
hash $remote_addr consistent;
# 转发的目的地址和端口
server 10.164.31.213:;
} # 提供转发的服务,即访问localhost:,会跳转至代理bss_num_socket指定的转发地址
server {
listen ;
proxy_connect_timeout 10s;
proxy_timeout 10m;
proxy_pass num_socket02;
} upstream num_socket03 {
hash $remote_addr consistent;
# 转发的目的地址和端口
server 10.164.31.213:;
} # 提供转发的服务,即访问localhost:,会跳转至代理bss_num_socket指定的转发地址
server {
listen ;
proxy_connect_timeout 10s;
proxy_timeout 10m;
proxy_pass num_socket03;
}
}

stream01.conf

nginx 端口转发配置的更多相关文章

  1. nginx 端口转发

    nginx 端口转发 默认nginx监听的端口是8080,想通过配置nginx访问80直接跳转到nginx,以下是配置方法: [root@localhost vhost]# cat tomcat.jo ...

  2. Nginx 路由转发配置(转)

    Nginx 路由转发配置笔记 由于预算有限,只有一台服务器,想要玩的东西不少,所以这个台服务器上会提供多重服务,因此涉及到的nginx转发就必有重要了 由nginx做请求代理,提供多种服务 php搭建 ...

  3. Apache 负载均衡 端口转发 配置

    转载自:https://blog.csdn.net/snihcel/article/details/38844323 [端口转发配置]       通过http_proxy做tomcat的端口转发: ...

  4. Linux下使用Nginx端口转发出现502错误的一种解决办法

    今天圈里的一个朋友在配置完nfinx80端口转发到5000后,发现一个问题 问题描述: 正确配置了Nginx80端口转5000端口,在CentOS上把.Net core WebAPI站点上传到cent ...

  5. nginx之location部署yii项目(不使用nginx端口转发)

    前言: 之前部署yii项目的时候, 使用的是域名, 后来使用nginx进行端口转发(反向代理)来部署yii项目. 这一次部署尝试只使用location 进行部署(不需要使用端口). 先贴出nginx的 ...

  6. nginx 端口转发 (proxy_pass反向代理)

    第一种(访问IP转发到IP+端口) server{ listen ; server_name 192.168.1.114; index index.php index.html index.htm; ...

  7. Ubuntu环境下的iptables的端口转发配置实例

    打开转发开关要让iptables的端口转发生效,首先需要打开转发开关方法一:临时打开,重启后失效$sudo su#echo 1 >/proc/sys/net/ipv4/ip_forward 方法 ...

  8. nginx请求转发配置

    以下为无ssl证书配置的请求转发 server { listen ; server_name api.****.com; #以下为指定请求域名匹配到某一个端口 #location ~* /union ...

  9. SNAT端口转发配置

    需求说明 在只有外网地址的机器上也能正常访问内网地址 配置过程 环境网络信息 网络名称 网络地址 外网 192.168.200.0/24 (网关:192.168.200.251) 内网 92.0.0. ...

随机推荐

  1. Connecting Elixir Nodes with libcluster, locally and on Kubernetes

    转自:https://www.poeticoding.com/connecting-elixir-nodes-with-libcluster-locally-and-on-kubernetes/ Tr ...

  2. goreplay 输出流量捕获数据到 elasticsearch

    goreplay 是一个很不错的流量拷贝,复制工具,小巧,支持一些扩展,当然也提供了企业版,企业版 功能更强大,支持二进制协议的分析 . 为了方便数据的存储,我们可以使用es 进行存储 环境准备 do ...

  3. 使用ipns 解决ipfs 内容更新的问题

    ipds 可以使用dnslink 解决域名访问的问题,但是内容变更我们就会有新的hashid 解决方法我们可以使用ipns ,同时解决dnslink 解决域名的问题 环境准备 docker-compo ...

  4. c#实现RGB字节数组生成图片

    我是要用c#来实现,现在已经知道了rgb数组,那么如何快速生成一张图片呢? 其实这个话题并不局限于是rgb字节数组的顺序,只要你能对于上表示红.绿.蓝的值,就可以生成图片.知道了原理,做什么都简单了. ...

  5. C# 线程:定时器的使用

    转载请注明出处:http://www.cnblogs.com/KeenLeung/p/3911556.html Timer类:设置一个定时器,定时执行用户指定的函数. 定时器启动后,系统将自动建立一个 ...

  6. 【转】Android AlertDialog自定义布局

    原文网址:https://blog.csdn.net/u010694658/article/details/53022294 由于开发中经常使用弹框,然而系统自带的弹框太局限,也不太美观,经常不能满足 ...

  7. 几种always块的形态

    几种always块的形态 1.时钟沿触发与复位触发 2.使能触发 3.预设触发 4.时序寄存器与锁存触发 5.组合逻辑

  8. 阅读 ‘External Memory PHY Interface (ALTMEMPHY)’笔记

    阅读 ‘External Memory PHY Interface (ALTMEMPHY)’笔记 1.PLL reference clock frequency 此处控制器输入时钟设置为100MHz, ...

  9. MHA 报错:There is no alive slave. We can't do failover

    dba http://blog.csdn.net/zengxuewen2045/article/details/51524880 关于这个错误:   1 2 3 4 Mon Feb 13 10:29: ...

  10. 单进程与 多进程关系及区别(多进程系统linux)

    单进程编程:顺序执行 数据同步 复杂度低 用途单一 多进程编程:同时执行 数据异步 复杂度高 用途广泛 1. 多进程的优势在于任务的独立性,比如某个任务单独作为一个进程的话,崩溃只影响自己的服务,其他 ...