lando / nginx

The Official NGINX Lando Plugin
https://docs.lando.dev/nginx/
GNU General Public License v3.0
6 stars 6 forks source link

NGINX Using multiple php-fpm containers #5

Open Xilonz opened 3 years ago

Xilonz commented 3 years ago

I'm trying to create a setup where we can quickly check if our plugin is working in \w multiple PHP versions.

NGINX is cycling through the available PHP services, no matter what NGINX service you are visiting. On each visit, the next service will be used.

The cause of this issue is the static network name that is used for the php-fpm service (defined here). All the services will get the same network alias, so NGINX doesn't have a clue which PHP service belongs to him.

recipe: wordpress
name: myphpproject
config:
  php: '7.4'
  config:
    vhosts: .lando/default.conf.tpl
proxy:
  appserver_nginx:
    - myphpproject.lndo.site
  php80_nginx:
    - 80-myphpproject.lndo.site
  php56_nginx:
    - 56-myphpproject.lndo.site
services:
  php80:
    type: php:8.0
    via: nginx
    webroot: .
  php56:
    type: php:5.6
    via: nginx
    webroot: .

/w overrides it would (probably, untested) look like this:

  php56:
    type: php:5.6
    via: nginx
    config:
       vhosts: .lando/56-default.conf.tpl #we need to change file so we can change the upsteam php
    overrides:
      networks:
        default:
          aliases: 
            - fpm3

Ideally, we would be able to attach multiple PHP services to one NGINX service. I've tried setting the via to cli and image to fpm so no additional NGINX service will be created and used the overrides mentioned above. This seems to work, however, I haven't figured out the correct NGINX config yet.

Any other suggestions for quickly switching between PHP versions are also welcome. NGINX is required.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

Xilonz commented 2 years ago

unstale - issue is still relevant :)

pirog commented 2 years ago

@Xilonz i moved this over to the right issue queue. @labboy0276 this might be an easy one to take care of. I think all we have to do is make the alias a bit more dynamic.