gpt4 book ai didi

php - Rancher sidekick php-fpm端口映射

转载 作者:行者123 更新时间:2023-12-02 19:34:36 27 4
gpt4 key购买 nike

我正在与此docker-compose一起使用rancher:

version: '2'
volumes:
data: {}
services:
web:
image: nginx:latest
volumes:
- /some_local_dir/services.conf:/etc/nginx/conf.d/site.conf
volumes_from:
- my-service
ports:
- 9082:80
labels:
io.rancher.sidekicks: my-service
my-service:
image: my-service
volumes:
- my-service:/my-service
ports:
- 9001:9000

我的服务-是基于alpine3.6的镜像,安装了php7-fpm

我的services.conf是:
server {
root /my-service/web;
server_name my-service.local;

location / {
try_files $uri /app.php$is_args$args;
}
location ~ ^/app\.php(/|$) {
fastcgi_pass my-service.web:9001;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;

# increase url max size passed to fast CGI interface
fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;

internal;
}

error_log /var/log/nginx/my-service_error.log;
access_log /var/log/nginx/my-service_access.log;
}

然后我得到了错误:

[error] 10#10: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 10.42.0.1, upstream: "fastcgi://10.42.94.81:9001"



当我删除端口映射,并且将fpm端口保持未激活状态(9000:9000)时
全部开始工作

Github helped me找出php-fpm7不能正常工作的原因,我在我的服务镜像中更新了/etc/php7/php-fpm.d/www.conf,而不是默认值
listen = 127.0.0.1:9000

我写
listen = 9000

它使事情适用于9000:9000,但适用于9001:9000-否((

在我的情况下,请帮助了解如何将fpm转发至9001

最佳答案

似乎我滥用了配置,在为 Rancher sidekick 输入后,这意味着所有外部外部容器的my-service:9001将打开,而父容器仍为9000。

my-service:
image: my-service
volumes:
- my-service:/my-service
ports:
- 9001:9000

因此,如果我不想将fpm暴露给外部容器,则根本不需要端口映射。

如果需要在9001上进行操作,唯一的方法是重新定义fpm的默认值并在9001上启动它,或者甚至更正确的方法-为应用程序使用单独的池。

关于php - Rancher sidekick php-fpm端口映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47205282/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com