@@ -51,7 +51,6 @@ def __init__(self):
5151 self .config_file = 'config.yml'
5252 self .docker_compose_file = 'docker-compose.yml'
5353 self .nginx_config_dir = 'docker/nginx/config'
54- self .apache_config_dir = 'docker/apache-php-56/config/sites-enabled'
5554 self .templates_dir = 'docker/nginx/config/templates'
5655 self .docker_templates_dir = 'templates'
5756
@@ -501,10 +500,15 @@ def generate_configs(self):
501500 f'{ self .nginx_config_dir } /mailpit.conf' ]:
502501 os .remove (config_file )
503502
504- apache_configs = glob .glob (f'{ self .apache_config_dir } /*.conf' )
505- for config_file in apache_configs :
506- if config_file != f'{ self .apache_config_dir } /default.conf' :
507- os .remove (config_file )
503+ # Clean up Apache configs for all Apache PHP versions
504+ apache_versions = [server for server in php_servers if server .startswith ('apache-php-' )]
505+ for apache_version in apache_versions :
506+ apache_config_dir = f'docker/{ apache_version } /config/sites-enabled'
507+ if os .path .exists (apache_config_dir ):
508+ apache_configs = glob .glob (f'{ apache_config_dir } /*.conf' )
509+ for config_file in apache_configs :
510+ if config_file != f'{ apache_config_dir } /default.conf' :
511+ os .remove (config_file )
508512
509513 # Generate nginx configs
510514 for host , host_data in config .items ():
@@ -524,9 +528,12 @@ def generate_configs(self):
524528 print (f" HTTPS config created: { https_config_file } " )
525529
526530 # Generate Apache config if using Apache PHP
527- if host_data .get ('php_version' , '' ).startswith ('apache-php-' ):
531+ php_version = host_data .get ('php_version' , '' )
532+ if php_version .startswith ('apache-php-' ):
528533 apache_config = self .generate_apache_config (host_data )
529- apache_config_file = f'{ self .apache_config_dir } /{ host_data ["main_host" ]} .conf'
534+ apache_config_dir = f'docker/{ php_version } /config/sites-enabled'
535+ os .makedirs (apache_config_dir , exist_ok = True )
536+ apache_config_file = f'{ apache_config_dir } /{ host_data ["main_host" ]} .conf'
530537 with open (apache_config_file , 'w' ) as f :
531538 f .write (apache_config )
532539 print (f" Apache config created: { apache_config_file } " )
0 commit comments