在以下存储库中:
https://github.com/napolev/lab-nginx-angular/tree/nasiruddin-suggestions
我有3个元素
nginx服务器app1app2app2是一个克隆app1
我正在使用Windows 10操作系统与Cygwin.
要试用该系统,请打开 3 个终端窗口并执行以下操作:
$ mkdir lab-nginx-angular
$ cd lab-nginx-angular
$ git clone https://github.com/napolev/lab-nginx-angular .
$ git checkout nasiruddin-suggestions
---
$ cd nginx
$ ./nginx.exe
---
$ cd app1
$ ng serve
---
$ cd app2
$ ng serve
Run Code Online (Sandbox Code Playgroud)
内部文件:.angular-cli.json我有以下内容(例如app1:):
{
...
"defaults": {
"styleExt": "css",
"component": {},
"serve": {
"host": "app1.example.com",
"port": 4201
}
}
...
}
Run Code Online (Sandbox Code Playgroud)
app1 …
我们有一个带有 SSL 的 Squid 代理,使用自签名证书和 ca-bundle.cert。直到最近,NPM 安装在尝试安装时才开始失败
npm --registry https://registry.npmjs.org \ --proxy http://localhost:10080 --https-proxy http://localhost:10443 \ --ddd install express
产生错误 -
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/express failed,
reason: unable to verify the first certificate
Run Code Online (Sandbox Code Playgroud)
Squid 正在 Docker 中运行,其日志显示
NONE/200 0 CONNECT registry.npmjs.org:443 - HIER_DIRECT
Run Code Online (Sandbox Code Playgroud)
任何想法或指示将不胜感激。
我将“dns_v4_first on”添加到了squid.conf中,现在NPM错误消息是
npm verb node v8.9.3
npm verb npm v5.5.1
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npmjs.org/express failed, reason: self signed certificate in certificate …Run Code Online (Sandbox Code Playgroud) 我有一个由子域分隔的多租户网站。我网站上的每个用户都有自己的子域。这与 shopify、squarespace 等网站使用的模式相同:
mary.marketplacesite.com
matt.marketplacesite.com
john.marketplacesite.com
Run Code Online (Sandbox Code Playgroud)
用户还可以选择通过向我的反向代理服务器 (sites.marketplacesite.com) 提供 A 和 CNAME 记录来使用其自定义域。Shopify/Squarespace 有相同的确切说明:
https://help.shopify.com/manual/domains/connecting-existing-domains/setting-up-your-domain
完成此操作后,我必须手动将该站点添加到conf文件中:
server {
listen 80;
server_name www.mary.com mary.com;
location / {
access_log off;
proxy_pass http://mary.marketplacesite.com;
}
}
Run Code Online (Sandbox Code Playgroud)
这一切都有效,但这真的是 Shopify/Squarespace 对数千个网站所做的吗?他们如何自动更新代理服务器配置?有更好的方法吗?
我是否必须为每个自定义域创建一个服务器块?或者有一个脚本来生成该 .conf 文件并将其存储在“/etc/nginx/conf.d/”中?我也听说有Nginx+,但是有更便宜的方法吗?
我已在本地开发平台上成功将 SSO/SAML2 与 Spring Security SAML 集成。
现在,我想将其安装在反向代理后面的生产环境中。反向代理配置如下: https://mycustomer.company.com/api/auth/xxx重定向到http://local_ip:local_port/auth/xxx
我遵循了 SAMLContextProviderLB bean 配置(第 10.1 章 - https://docs.spring.io/spring-security-saml/docs/current-SNAPSHOT/reference/pdf/spring-security-saml-reference.pdf)。
但登录成功后,我被重定向到这个无效的网址:http ://mycustomer.company.com**/auth/**
我认为它来自#successRedirectHandler bean。但是,如果我输入正确的 URL ( https://mycustomer.company.com/api/auth/index.jsp ),我会在 SAML 识别过程中无限循环(返回到 IDP,然后是 SDP...)。
我当然误解了配置中的某些内容,但我看不出在哪里。感谢您的帮助。
我在我的nginx/error.log. 这只是一个警告而不是错误,但我应该修复它吗?它是否会导致 DDOS 攻击?我该如何解决它?我在 AWS Elastic Beanstalk 上使用 Nginx 作为 Tomcat 的代理。
2018/11/25 22:01:14 [警告] 3402#0: *81345 在读取上游时,上游响应被缓冲到临时文件 /var/lib/nginx/tmp/proxy/6/12/0000002126,客户端: 172.99.99.99,服务器:,请求:“GET /fonts/font-600.woff2 HTTP/1.1”,上游:“ http://127.0.0.1:8080/fonts/font-600.woff2 ”,主机:“示例.com”,引荐来源:“ http://example.com/css/style.css ”
我已将 Nginx 设置为反向代理。我将代理指向 java 应用程序。问题是 Nginx504 Timeout while reading response from server在 60 秒后返回。Nginx 或 java 应用程序中没有错误日志。如果我直接点击 java 应用程序,它会为请求提供超过 60 秒的时间,但如果我通过 Nginx 执行此操作,它会在 60 秒后超时。我在 nginx.conf 文件中添加了以下配置。
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
keepalive_timeout 650;
Run Code Online (Sandbox Code Playgroud)
奇怪的是,如果我将超时设置更改为小于 60 秒,它会按预期工作。我还尝试将 Nginx 指向 NodeJs 应用程序,以确保问题不在 java 应用程序中。行为保持不变。
我还需要修复其他配置吗?
Nginx 版本:1.14.0
PS:我也尝试过使用 kubernetes Nginx ingress。问题仍然相同。
我在 nginx 配置中使用以下内容来代理对单独静态网站服务器的特定路径的请求。
server {
listen 80;
server_name _ localhost; # need to listen to localhost for worker tier
location / {
proxy_pass https://mywebsite.com;
proxy_set_header Host mywebsite.com;
proxy_set_header X-Real-IP $remote_addr;
}
}
Run Code Online (Sandbox Code Playgroud)
第一次/team访问该路径时,它工作正常。但后续请求会导致HTTP 426Chrome 出错。在隐身窗口中打开它效果很好,但有时也会出现 426 错误。
nginx 错误日志中没有与此相关的错误。426 文档并不能帮助我们解决这个问题。
Nginx 在 ElasticBeanstalk 环境中运行,该环境使用应用程序负载均衡器,该负载均衡器接受 HTTP / HTTPS 请求并将它们转发到应用程序实例的端口 80。
我正在尝试使用此处给出的说明在 nginx 后面设置 Airflow。
气流.cfg 文件
base_url = https://myorg.com/airflow
web_server_port = 8081
.
.
.
enable_proxy_fix = True
Run Code Online (Sandbox Code Playgroud)
nginx配置
server {
listen 443 ssl http2 default_server;
server_name myorg.com;
.
.
.
location /airflow {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto "https";
}
}
Run Code Online (Sandbox Code Playgroud)
Airflow Web 服务器和调度程序已启动并作为 systemd 运行。当我尝试访问https://myorg.com/airflow/时,它给出了 Airflow 404 = 很多圆圈。
可能出什么问题了?非常感谢您为运行此程序提供的帮助。
我有一个关于用作反向代理和 Keycloak 的 Apache 的问题。除了我的反向代理之外,还有另一个由客户应用的反向代理。
我想登录 Keycloak 的管理控制台。尝试在本地按预期执行此操作:http://localhost/application1/auth/admin/ 显示登录表单,我可以成功登录。
但尝试从外部 URL 登录不起作用: https: //externalurl.com/application1/auth/admin/
显示登录表单,我提交表单,然后再次显示(空)表单。Cookie AUTH_SESSION_ID、KC_RESTART、KEYCLOAK_IDENTITY 和 KEYCLOAK_SESSION 设置正确。
Apache 的 access.log 中的视图显示以下内容:(本地和工作调用)
10.1.7.192 - - [29/May/2019:11:16:27 +0200] "GET /auth/admin/master/console HTTP/1.1" 302 -
10.1.7.192 - - [29/May/2019:11:16:28 +0200] "GET /auth/admin/master/console/ HTTP/1.1" 200 8198
10.1.7.192 - - [29/May/2019:11:16:29 +0200] "GET /auth/admin/master/console/config HTTP/1.1" 200 195
10.1.7.192 - - [29/May/2019:11:16:29 +0200] "GET /auth/realms/master/protocol/openid-connect/auth?client_id=security-admin-console&redirect_uri=https%3A%2F%2Fexternalurl.com%2Fapplication1%2Fauth%2Fadmin%2Fmaster%2Fconsole%2F&state=cef5a6cb-4327-45e7-8e97-0b3e74a27ea6&response_mode=fragment&response_type=code&scope=openid&nonce=35edfb09-a16a-41dc-83d6-453393e61391 HTTP/1.1" 200 3120
10.1.7.192 - - [29/May/2019:11:16:33 +0200] "POST /auth/realms/master/login-actions/authenticate?session_code=5iqyNYW56tGETAGGHLEp54m5JbEXU4us-kDe1S1k10Q&execution=ee5e5166-6dcf-47d1-a130-521aaedfd08d&client_id=security-admin-console&tab_id=VF8WaW2--uM HTTP/1.1" 302 -
10.1.7.192 - - [29/May/2019:11:16:33 +0200] "GET …Run Code Online (Sandbox Code Playgroud) 这就是我目前拥有的
domain.com -> website A with its own firebase host (domain.firebase.com)
me.domain.com -> website B with its own firebase host (domain-me.firebase.com)
Run Code Online (Sandbox Code Playgroud)
这并不难设置,只需将多个子域重定向到不同的 Firebase 主机即可。现在,我想要的是反向代理接受请求,并可以选择将流量路由到各种服务器,同时将客户端 URL 仅保留在domain.com主域上。我不确定这对于 Firebase是否可行,因为有大量的 NGINX 实现示例,但基本上,我想要这个:
domain.com/ -> website A with its own firebase host (domain.firebase.com)
domain.com/me -> website B with its own firebase host (domain-me.firebase.com)
Run Code Online (Sandbox Code Playgroud)
Firebase 具有非常复杂的重定向选项,但重定向也会覆盖客户端 URL。因此,通过重定向,客户端将看到domain-me.firebase.com而不是domain.com/me,这不是我想要的。
据我所知,我可以使用 Firebase Cloud 功能作为中间件,并让它根据需要为任一站点提供服务。然而,这会带来大量延迟,因为云功能和 Firebase 托管网站都有冷启动时的预热时间。
不给我完整而详细的答案也没关系,我真的只是想知道这是否可以开始,以及在哪里可以找到相关资源。谢谢!
proxy reverse-proxy firebase firebase-hosting google-cloud-functions