牧场主sidekick php-fpm端口映射

我正在使用这个docker-compose的牧场主:</ p>

 版本:'2'
volumes:
data:{}
services:
web:
image:nginx:latest
卷:
  • /some_local_dir/services.conf:/etc/nginx/conf。 d / site.conf volumes_from:
  • my-service ports:
  • 9082:80 标签: io.rancher.sidekicks:my-service my-service: image: my-service 卷:
  • 我的服务:/ my-service ports:
  • 9001:9000
    </ code> </ pre>

    my-service - is 图像构建在alpine3.6上,安装了php7-fpm </ p>

    我的services.conf是:</ p>

      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)(/。*)$;
    包括fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $ document_root $ fas tcgi_script_name;
    fastcgi_param HTTPS关闭;

#增加传递给快速CGI接口的url max size
fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;

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


nn

然后我收到错误:</ p>


[错误] 10#10:* 1连接()失败(111:连接被拒绝)连接到上游,客户端 :10.42.0.1,上游:“fastcgi://10.42.94.81:90​​01”</ p>
</ blockquote>

当我删除端口映射时,左fpm端口uncahnged(9000:9000) )
所有开始工作</ p>

Github帮助 我找到php-fpm7首先没有工作的原因,我在我的服务图片中更新了/etc/php7/php-fpm.d/www.conf,而不是默认< / p>

 <代码>听 = 127.0.0.1:9000

我写了</ p>

  listen = 9000 
</ code> </ pre>

它使得东西适用于9000:9000,但是对于9001:9000 - nope((</ p>

请帮助理解如何将fpm转发到9001, 在我的情况下</ p>
</ div>

展开原文

原文

I'm using rancher with this docker-compose:

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

my-service - is image build upon alpine3.6, with installed php7-fpm

My services.conf is:

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;
}

And then I'm getting error :

[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"

When I remove port mapping, and left fpm port uncahnged (9000:9000) All starts working

Github helped me to find the reason why php-fpm7 wasn't working in the first place, I've updated /etc/php7/php-fpm.d/www.conf in my-service image, instead of default

listen = 127.0.0.1:9000

I wrote

listen = 9000

It makes things works for 9000:9000, but for 9001:9000 - nope ((

Please help to understand how can I forward fpm to 9001, in my case

1个回答



似乎我误用了配置,在输入牧场主之后 sidekick </ strong>意味着my-service:9001将会打开 对于所有外部</ strong>容器,同时保留9000个父容器。</ p>

  my-service:
image:my-service
volumes:
  • 我的服务:/ my-service ports:
  • 9001:9000
    </ code> </ pre>

    所以我根本不需要端口映射,如果 我不想将fpm暴露给外部容器。</ p>

    如果需要在9001上工作,唯一的方法是重新定义fpm的默认值并在9001上启动它,甚至是 更正确的方法 - 为应用程序使用单独的池。</ p>
    </ div>

展开原文

原文

Seems I misused configs, following entry for the ranchers sidekick means that my-service:9001 will be open for the all external containers, while 9000 remains for the parent container.

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

So I don't need port mapping at all , if I don't want to expose fpm to external containers.

If there is a need to work on 9001, only way is to redefine defaults of fpm and start it on 9001, or even a more right way - is to use separate pool for the application.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐