惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Security Latest
Security Latest
Project Zero
Project Zero
A
Arctic Wolf
L
LINUX DO - 热门话题
Microsoft Azure Blog
Microsoft Azure Blog
P
Palo Alto Networks Blog
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cloudbric
Cloudbric
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
T
Threatpost
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
PCI Perspectives
PCI Perspectives
WordPress大学
WordPress大学
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
The Hacker News
The Hacker News
V
Visual Studio Blog
M
MIT News - Artificial intelligence
月光博客
月光博客
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
Attack and Defense Labs
Attack and Defense Labs
The Register - Security
The Register - Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MyScale Blog
MyScale Blog
N
Netflix TechBlog - Medium
S
Security Affairs
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Spread Privacy
Spread Privacy
AI
AI
S
Schneier on Security
L
LangChain Blog
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 叶小钗
量子位
H
Heimdal Security Blog
J
Java Code Geeks

博客园 - JiaLiWei

TFS2017持续发布中调用PowerShell启停远程应用程序 基于BUI开发Asp.net MVC项目 WebAPI应用问题整理 C#多线程顺序依赖执行控制 TFS下载文件已损坏问题 Asp.net core中使用Session 为什么使用.Net Core, Asp.net Core以及部署到云端 基于微软开发平台构建和使用私有NuGet托管库 TFS2017代码搜索功能 Python sphinx-build在Windows系统中生成Html文档 Oracle PL/SQL Developer集成TFS进行团队脚本文件版本管理 Gulp自动构建Web前端程序 TFS应用经验-大型项目数据仓库抽取导致的TFS应用无法访问 TFS实现需求工作项自动级联保存 TFS 测试用例导入、导出工具 开发团队在TFS中使用Git Repository (二) 开发团队在TFS中使用Git Repository (一) TFS Services 集成Docker TFS 测试用例步骤数据统计
Web、WCF和WS通过Nginx共享80端口
JiaLiWei · 2017-12-21 · via 博客园 - JiaLiWei

团队中的一个Web项目面对的用户网络环境多是在严格的防火墙安全条件下,通常只开放一些标准的端口如80,21等。

上线初期,因忽略了这个问题,除了Web应用是以80端口提供访问外,WCF和WS是以其他端口进行对外访问的,导致多数用户无法完整的使用系统的全部功能,如涉及直接访问WCF和WS服务的功能。

同时加上分配给这个项目外网IP地址资源只有一个,因此对外的直接服务除了使用80端口,其他服务当时就直接采用了其他端口。

为了解决这个问题,在Web服务器上(80端口),采用Nginx解析Web Request中的请求特征,把针对Web、WCF服务和WS的请求分别转发到内网对应的物理服务器上。

解析的规则如下:

规则一:默认的80端口请求,转发到Web服务上。

规则二:在规则一的基础上,如果请求URI中包含”.svc/”格式的字符串,转发到WCF服务器上。

规则三:如果Request Headers中包含Upgrade信息,且值为websocket的话,转发到WebSocket服务器上。

Nginx配置文件内容如下:

upstream wcfServer { 

    server 10.0.0.111:8089;

}

upstream webServer { 

    server 10.0.0.118:8000;

}

upstream socketServer { 

    server 10.0.0.112:7181;

}

server { 

    listen 80; 

    location / { 

                proxy_pass http:// webServer ;

                if ( $request_uri ~* \.(svc)/~* )

        {

                        proxy_pass http:// wcfServer ; 

                 }

        if ( $http_upgrade ~* websocket$ )

        {

                        proxy_pass http:// socketServer ; 

                 }

        proxy_http_version 1.1; 

        proxy_set_header Upgrade $http_upgrade; 

        proxy_set_header Connection "Upgrade";

                proxy_send_timeout 600s;

                client_max_body_size 1024M;

                client_body_buffer_size 4096k; 

    } 

}