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

推荐订阅源

P
Privacy International News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
T
Tailwind CSS Blog
WordPress大学
WordPress大学
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
C
CERT Recently Published Vulnerability Notes
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
雷峰网
雷峰网
Schneier on Security
Schneier on Security
博客园 - 聂微东
T
Tor Project blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AI
AI
T
Troy Hunt's Blog
Security Latest
Security Latest
T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Check Point Blog
T
Threat Research - Cisco Blogs
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
Recorded Future
Recorded Future
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cloudbric
Cloudbric
J
Java Code Geeks
罗磊的独立博客
C
Cyber Attacks, Cyber Crime and Cyber Security
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
Lohrmann on Cybersecurity
I
InfoQ
MongoDB | Blog
MongoDB | Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
The Hacker News
The Hacker News
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
N
News and Events Feed by Topic

博客园 - 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; 

    } 

}