问题标签 [jwilder-nginx-proxy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
203 浏览

docker - Docker add php project on subdomain

I have two projects. An API in Node.js and a web application in PHP.

I'm using jwilder/nginx-proxy and I want to add the API on api.example.com and the application on vault.example.com. On example.com I will have some static HTML pages.

The subdomain for the API works as expected.

Now my question is about the vault subdomain and about the static HTML pages.

To create an image for these projects I have to use Apache or Nginx, which means that the proxy will make a call to another web server to open the applications. Is this a correct way or the best option is to create volumes for these projects and add them inside the proxy with custom conf file?

0 投票
2 回答
1041 浏览

docker - Fail2ban 匹配正则表达式,但在监控来自 docker 容器的流量时禁止的 ip 似乎是错误的?

简短的总结:

我正在尝试在监控 docker 容器中的流量的主机上配置 fail2ban。我的fail2ban 匹配,fail2ban 确实禁止了IP 地址。但是它禁止的IP地址是错误的?

设置和诊断

  • 通过这个 repo 运行一个带有letsencrypt docker容器的nginx:https ://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion on digitalocean。
  • 在宿主机上安装了fail2ban(即不在容器中)
  • 我还必须对过滤器正则表达式进行自定义修改,因为 docker 日志在 json 中,我将在下面概述:

示例片段jail.local

我的自定义php-custom.conf过滤器规则:(我正在尝试禁止任何 php,因为我正在运行 .net 应用程序):

我试图阻止/禁止的可怕垃圾邮件流量:

当我用 测试它时fail2ban-regex,见下文,NB 127.0.0.1 不是我的真实 IP 地址。

我得到的输出:

它似乎匹配,但似乎说匹配的 ip 地址是0.0.0.2 Sat Jul 07 06:15:10 2018??

我让这个设置运行了一段时间,因为我认为它正在工作,当通过运行检查状态时,fail2ban-client status php-custom我得到以下信息:

ip地址似乎都是0.0.0.1等等0.0.0.2

我希望它应该是实际的 IP 地址,因为我仍然收到垃圾邮件流量。

任何建议或帮助,因为我对 fail2ban 和 docker 很陌生,将不胜感激。

0 投票
2 回答
1568 浏览

mysql - 使用 wordpress 和 mysql 容器的 Docker Nginx 反向代理坏网关

我也搜索其他问题,但它们不适合我。(Docker nginx 反向代理给出“502 Bad Gateway”docker nginx 502 bad gateway

在我的情况下,我将 docker-ce 安装到我的个人 VPS 服务器上,如下所示:

然后

拉取标准最新版本wordpress, mysqljwilder/nginx反向代理

并使用给定的标准代码

MYSQL:

WordPress:

和 NGINX 反向代理:

那有什么问题?

问候

0 投票
2 回答
11840 浏览

amazon-ec2 - 当客户端不在本地主机上时,redirect_uri Keycloak 无效

我的 Keycloak 服务器部署在反向代理后面的 aws EC2 上,而我的前端客户端(Springbootapp)位于不同的 EC2 上。

现在我收到 Invalid redirect_uri 错误,尽管它在前端客户端位于 localhost 并且 Keycloak 在 aws 上时有效。IE

Keycloak 可在以下位置访问:http://api.my-kc.site/

Valid Redirect URIs: http://localhost:8012/* and /login/* 作品

查询:https ://api.my-kc.site/auth/realms/WebApps/protocol/openid-connect/auth?response_type=code&client_id=product-app&redirect_uri=http%3A%2F%2F localhost %3A 8012 %2Fsso %2Flogin&state=53185486-ef52-44a7-8304-ac4cfeb575ee&login=true&scope=openid

Valid Redirect URIs: http://awspublicip:80/* and /login/* 不工作 而且我也尝试了不指定端口的建议,即http://awspublicip/ *; 但这仍然不起作用:/

查询:https: //api.my-kc.site/auth/realms/WebApps/protocol/openid-connect/auth?response_type=code&client_id=product-app&redirect_uri=https%3A%2F%2F awspublicip %3A 0 %2Fsso %2Flogin&state=8bbb01e7-ad4d-4ee1-83fa-efb7f05397cc&login=true&scope=openid

有人有想法吗?我一直在查看所有 Invalid redirect_uri 帖子,但似乎没有任何结果。

当请求的发起者不是 localhost 时,似乎 Keycloack 会为查询生成不同的重定向 URI。有人知道如何避免这种情况吗?

本地主机

公共DNS

0 投票
2 回答
5143 浏览

nginx - 如何在 https NGINX 中将非 www 重定向到 www

我有一个与 Nginx 重定向相关的问题 Bellow 你可以看到配置。我的目标是从https://example.com重定向到https://www.example.com

我几乎在stackoverflow中查看了所有内容,但没有找到任何帮助。请帮我解决这个问题。我将提供有关我的 Nginx Web 服务器的所有必要信息。我希望你能帮助我,解决这个困难的问题。

我的文件nginx.conf看起来像那里:

我的档案/etc/nginx/sites-enabled/example:

0 投票
1 回答
772 浏览

nginx - Nginx和后端服务器建立连接超时后,我想让Nginx返回json数据给客户端。如何配置它?

假设需求是这样的:Nginx监听的端口是80,假设后端服务器域名是:http ://hello.com,Nginx作为代理接受客户端的请求,Nginx转发请求http://hello.com。如果 Nginx 和后端服务器建立连接超时,则必须将 json 格式的数据返回给客户端。假设数据如下:

{ "code": -1 "message":"failed to connect remote error" }

而我想让客户端收到一个500的状态码,想请教前辈实现这个功能,Nginx怎么配置?

0 投票
2 回答
1897 浏览

amazon-web-services - AWS ECS jwilder/nginx-proxy 无法在上游生成服务器

我正在尝试将jwilder/nginx-proxy设置为反向代理,以将请求代理到公开 VIRTUAL_HOST=example.com 环境变量的各种容器。

如果容器直接在 ec2 集群主机上启动,则设置有效,但如果它是从 ECS 生成的,则会失败并显示以下错误:“error running notify command: nginx -s reload, exit status 1”。

运行 jwilder/nginx-proxy 容器的容器的 docker 日志: WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one is being generated in the background. Once the new dhparam.pem is in place, nginx will be reloaded. forego | starting dockergen.1 on port 5000 forego | starting nginx.1 on port 5100 dockergen.1 | 2018/08/19 10:43:37 Generated '/etc/nginx/conf.d/default.conf' from 4 containers dockergen.1 | 2018/08/19 10:43:37 Running 'nginx -s reload' dockergen.1 | 2018/08/19 10:43:37 **Error running notify command: nginx -s reload, exit status 1** dockergen.1 | 2018/08/19 10:43:37 Watching docker events dockergen.1 | 2018/08/19 10:43:37 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload' 2018/08/19 10:48:23 [emerg] 38#38: no servers are inside upstream in /etc/nginx/conf.d/default.conf:55 nginx: [emerg] no servers are inside upstream in /etc/nginx/conf.d/default.conf:55 Generating DH parameters, 2048 bit long safe prime, generator 2 This is going to take a long time dhparam generation complete, reloading nginx

环境配置如下:

测试命令:

它现在返回默认的 nginx 页面,因为 nginx 配置文件无法生成有效配置,因为缺少上游主机。

生成的无效 nginx 配置

如果使用以下命令,代理将按预期工作:

如果运行上面的命令,它会给出以下输出: WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one is being generated in the background. Once the new dhparam.pem is in place, nginx will be reloaded. forego | starting dockergen.1 on port 5000 forego | starting nginx.1 on port 5100 dockergen.1 | 2018/08/19 10:18:48 Generated '/etc/nginx/conf.d/default.conf' from 10 containers dockergen.1 | 2018/08/19 10:18:48 Running 'nginx -s reload' dockergen.1 | 2018/08/19 10:18:48 Watching docker events dockergen.1 | 2018/08/19 10:18:48 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload' 2018/08/19 10:19:09 [notice] 40#40: signal process started Generating DH parameters, 2048 bit long safe prime, generator 2 This is going to take a long time dhparam generation complete, reloading nginx 生成的有效 nginx 配置:

我的问题是:为什么这不起作用,是因为权限还是挂载到 docker 套接字?

0 投票
0 回答
250 浏览

docker - 如何让 jwilder/nginx-proxy 在 Amazon ECS 上工作?我收到 503 错误

这是我的设置:

Docker 为我的 wordpress 网站撰写文件

我的 Nginx 代理的 Docker Compose 文件

ecs compose up两个都跑。但是,当我尝试访问http://cashinyourpoints.com时,我收到“503:服务暂时不可用”错误。当我直接进入容器的 ip 时,我得到了同样的错误。当我运行测试命令时,我仍然得到同样的错误curl -H "Host: whoami.local" 54.184.203.137

我的ecs-cli ps输出

我在某处读到这可能与网络有关,但我不知道如何启动亚马逊版本的 Docker 网络(不支持 Docker 的网络属性)。

我被困在如何在 vpc 模型中创建子网?

0 投票
1 回答
1860 浏览

docker - 如何从另一个容器的公共地址访问反向代理后面的 docker 容器

我设置了 2 个 Docker 容器ab,它们都公开了 HTTP 服务。它们应该可以通过它们的虚拟主机名a.domain.comb.domain.com公开访问。此外,a 应该能够在其公共虚拟主机名上访问 b,即它应该能够在b.domain.com上访问 b 。

使用 docker-compose v2 文件完成 2 个容器的设置

我设置了 jwilder/nginx-proxy docker 容器来自动创建反向代理 nginx 配置。我的两个容器 a 和 b 通过其用户定义的桥接网络连接,但也连接到运行 nginx-proxy 的默认桥接网络(docker network connect bridge container-(a|b)

nginx-proxy 生成的 nginx 配置看起来相当不错。

这两个容器都可以通过它们的公共虚拟主机名从我的客户端计算机访问。问题是我的容器 A 无法通过其虚拟主机名 b.domain.com 访问容器 B。它可以通过container-b访问它,但这不是我的选择。关于我做错了什么的任何想法或提示?

0 投票
1 回答
197 浏览

docker - 本地机器上的多个站点和 Window 上的 docker

我正在尝试创建 2 个站点(具有相同的代码库只是为了测试)来测试 SSO 功能(与我的 SSO 问题无关),我正在使用 docker-compose.yml 文件。我已经在线获取了这个 yml 文件的副本,它在设置一个站点方面运行良好。我可以 docker-compose down 并运行第二个站点,这也可以,但我不确定如何同时设置 2 个站点(www.site1.test 和 www.site2.test)

我需要对此撰写文件进行哪些更改或创建一个新文件,以便我同时拥有 2 个站点。

我不是专家,所以我很感激任何答案。

TIA