Allow multiple php versions to be run using Nginx and Aegir

Created on 1 January 2023, almost 2 years ago
Updated 12 March 2024, 9 months ago

Problem/Motivation

Drupal 9.4.9 has a strong suggestion for php8.1.6.
it would be nice to be able to run aegir itself under php7.4 since it is still on Drupal 7 while having other sites run on the best php version for them which might be php8.1.6.

I see here that Nginx can be used to do it in general but since Aegir takes over the virtual hosting, what would have to be done to the aegir.conf file to support multiple php versions.

https://www.atlantic.net/vps-hosting/host-multiple-websites-with-differe...

This solutions was given in Slack by JonPugh but only works for apache2,
https://git.drupalcode.org/project/hosting/-/commit/9aaf9037e08fea425091...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia ac Perth

    You can do this manually by creating a file in /var/aegir/.drush/

    This example is for apache but you can use drush_hook_provision_nginx_vhost_config for nginx.

    <?php
    function foo_provision_apache_vhost_config($uri, $data) {
    
      $sites = [
        'www.site1.com',
        'www.site2.com',
      ];
    
      if (in_array($uri, $sites)) {
        return array("
        Include /etc/apache2/conf-available/php7.2-fpm.conf
        ");
      } else {
        return array("
        Include /etc/apache2/conf-available/php7.4-fpm.conf
        ");
      }
    }
    
  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    @ac, nginx does not use .conf files like this. There is not an equivalent for php7.4-fpm.conf.

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    I upgraded hostmaster to Drupal 7.100 which takes php8.1 and possibly 8.2

    I upgraded the file, /var/aegir/config/includes/nginx_vhost_common.conf, to reflect this

Production build 0.71.5 2024