- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个绑定(bind)到端口 443 的 NGINX 服务器,提供身份验证,并将所有 SSL 请求反向代理到一组后端服务器。另一台服务器在端口 80 上监听,但它暂时只是指向一个占位符页面。我如何让 NGINX 将所有外部请求重定向到受 SSL 保护的站点,同时将所有内部网请求重定向到没有 SSL 的相同站点?这是我的 nginx.conf 的相关部分:
server {
listen 80;
server_name intranet;
allow 10.10.0.0/16;
#charset koi8-r;
access_log logs/host.access.log main;
#######################################
#
# locations on LOCALHOST
#
#######################################
location / {
allow all;
root /data/www;
index index.html index.htm;
}
##############
# HTTPS server
##############
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /srv/ssl/ExternalSite.com.combined.crt;
ssl_certificate_key /srv/ssl/ExternalSite.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
#######################################
#
# Reverse proxy blocks
#
#######################################
#General ExternalSite web site
location / {
auth_basic "Please enter userid and password to enter the ExternalSite web site";
auth_basic_user_file /var/www/www.ExternalSite.com/.htpasswd;
proxy_buffers 16 4k;
proxy_buffer_size 2k;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
proxy_pass http://10.10.10.16:2080;
}
#nagios server
location /nagios {
auth_basic "Please enter userid and password to enter the ExternalSite nagios web site";
auth_basic_user_file /var/www/www.ExternalSite.com/.htpasswd;
proxy_set_header Authorization $http_authorization;
proxy_buffers 16 4k;
proxy_buffer_size 2k;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
proxy_pass http://10.10.10.18/nagios;
}
# # munin server
location /munin {
auth_basic "Please enter userid and password to enter the ExternalSite munin web site";
auth_basic_user_file /var/www/www.ExternalSite.com/.htpasswd;
proxy_set_header Authorization $http_authorization;
proxy_buffers 16 4k;
proxy_buffer_size 2k;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
proxy_pass http://10.10.10.18/munin;
}
#######################################
#
# End of Reverse proxy blocks
#
#######################################
}
最佳答案
要拆分 Intranet 和外部请求,请创建另一个服务器部分并修改 listen 指令以包含相应的接口(interface)。即,如果您的 Intranet 接口(interface)是 10.10.10.1 并且公共(public) IP 是 54.200.200.200,对于 Intranet 您将执行:听 10.10.10.1:80
对于外部请求:听 54.200.200.200:80
然后重定向到 ssl,使用 nginx 返回语句到同一个服务器,但使用 https。
更新:示例 Nginx 配置架构(根据评论):
#######################################
#
# Intranet server
#
#######################################
server {
listen 10.10.10.1:80 default_server;
server_name intranet;
allow 10.10.0.0/16;
deny all;
# server configuration with all locations, proxy_passes, etc.
}
#######################################
#
# Internet server, redirecting to ssl
#
#######################################
server {
listen 80;
server_name www.yourdomain.com;
location / {
return https://www.yourdomain.com$request_uri;
}
}
##############
# HTTPS server
##############
server {
listen 443 ssl;
server_name www.yourdomain.com;
# server configuration with all locations, proxy_passes, etc.
}
关于根据请求的来源将反向代理重定向到 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25583901/
我正在用 robocopy 编写一个 powershell 脚本来从列表中复制“完整的”unc/文件名路径。我遇到的问题是 robocopy 似乎在我的源路径末尾添加了一个 \。 我有一个 C:\te
我发现守护程序通过这些代码创建了一个容器 // NewBaseContainer creates a new container with its // basic configuration. fu
是否有所有潜在 map 源的列表?在示例页面上,可以浏览四种类型的 map 。外面还有什么? http://tombatossals.github.io/angular-leaflet-directi
是否有所有潜在 map 源的列表?在示例页面上,可以浏览四种类型的 map 。外面还有什么? http://tombatossals.github.io/angular-leaflet-directi
我们的网站比较多,第一次使用ElasticSearch不知道应该怎么配置ES: 我们想使用 ES 作为这些网站的唯一搜索引擎,我们是否应该为每个网站设置单独的 ES 实例? (我想这可能比一个 ES
我需要一些关于我对 UNI 项目的想法的建议。 我想知道是否可以将一个音频文件从不同的音频源分成不同的“流”。例如,将音频文件拆分为:引擎噪音、火车噪音、人声、并非始终存在的不同声音等。 我不一定需要
我想设置“公共(public)彩票”,每个人都可以看到选择是随机和公平的。如果我只需要一点,我会使用例如当天收盘道琼斯指数的 LSB。问题是,我需要 32 位。我需要一个来源: 每日可用 全世界都可以
来自 pickle 的 python 文档: Warning The pickle module is not secure. Only unpickle data you trust. 什么是 pi
我试图安排一个 liquidsoap 流媒体源在未来的特定日期和时间播放。我相信这可以使用 Liquidsoap switch 命令来完成,但我无法理解此处描述的文档:http://liquidsoa
对于Shiny应用程序,我希望能够播放在 session 本身期间生成的音频文件。 如果它是我要上传的音频文件,我将使用 tags$audio(src = "www/name.wav", ty
我想更改我的 OpenGL 来源。图片会说明: 现在是这样的: 这就是我想要的: 当前代码 gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL
我正在尝试让 Stripe 运行起来,我几乎已经完成了,但有一件令人困惑的事情。 source: 'tok_visa' 部分。看起来它可以是“tok_mastercard”、“bank_account
我已经下载了 primefaces 源代码,看看是否可以从中学习。该 jar 包含一堆使用编写器来处理渲染等的 java 类。我期待找到一些 .xhtml 文件 ... and etc etc
如果我查看页面源代码,我会看到 styling += 'ul#topnav a.tabHeader5'; styling += '{'
我正在尝试根据显示器的大小更改背景图像。它不在服务器上运行。您可以在 https://github.com/Umpalompa/Umpalompa.github.io 找到我的所有代码. 我尝试同时使
从here的最底部开始.有一个 URL 生成器,我可以使用引荐来源网址在 Google Play 上生成指向我的应用程序的链接。我如何从谷歌分析中提取该 Activity 来源?我一直在谷歌上搜索,但
我用 Google Weather API 制作了一个插件,目前我正在从 Google 的 API 中提取图像。对于晴天,我正在拉 http://www.google.com//ig/images/w
是否可以通过环境变量为 @CrossOrigin 注释指定来源?我想这样做,以便我可以将相同的代码库用于 uat/staging/production。我希望我的 uat/staging 环境可以通过
我需要等待我的 JavaScript 中的文档准备就绪,才能在正文底部插入一个 div。 我想: 使此 JavaScript 文件尽可能小(如果可能,将其编译到 < 1kb) 在闭包中内联提供文档就绪
我正在开发电子邮件服务并想连接到谷歌帐户,是否可以将我的本地主机用作授权的 JavaScript 来源? 最佳答案 第 1 步:启用 Google+ API http://localhost:4567
我是一名优秀的程序员,十分优秀!