From 85feb79c405409f98ac7d8f62a659e9636dc3228 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 14 Feb 2025 15:02:31 -0500 Subject: [PATCH] fix for job for apache2.service failed because the control process exited with error code. --- .github/workflows/deploy_aws.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_aws.yml b/.github/workflows/deploy_aws.yml index 905eb33..fd46ada 100644 --- a/.github/workflows/deploy_aws.yml +++ b/.github/workflows/deploy_aws.yml @@ -92,11 +92,32 @@ jobs: VHOST_CONF=' ServerAdmin webmaster@localhost DocumentRoot /var/www/html/jupyterbook_8040 - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + ErrorLog /var/log/apache2/error.log + CustomLog /var/log/apache2/access.log combined ' - if ssh -o StrictHostKeyChecking=no "${EC2_USER}@${EC2_HOST}" "sudo sed -i 's/Listen 80/Listen 8040/' /etc/apache2/ports.conf && echo '$VHOST_CONF' | sudo tee /etc/apache2/sites-available/jupyterbook.conf && sudo a2ensite jupyterbook.conf && sudo systemctl restart apache2"; then + if ssh -o StrictHostKeyChecking=no "${EC2_USER}@${EC2_HOST}" " + # Update ports.conf + sudo sed -i 's/Listen 80/Listen 8040/' /etc/apache2/ports.conf + + # Disable default site + sudo a2dissite 000-default.conf + + # Configure jupyterbook site + echo '$VHOST_CONF' | sudo tee /etc/apache2/sites-available/jupyterbook.conf + + # Enable site and restart Apache + sudo a2ensite jupyterbook.conf + sudo systemctl restart apache2 + + # Check Apache status + sudo systemctl status apache2 + "; then echo "✓ Apache configuration and restart successful" else echo "× Apache configuration failed"