aboutsummaryrefslogtreecommitdiff
path: root/debian/boca-web.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/boca-web.postinst')
-rw-r--r--debian/boca-web.postinst52
1 files changed, 43 insertions, 9 deletions
diff --git a/debian/boca-web.postinst b/debian/boca-web.postinst
index 2006bff..091905b 100644
--- a/debian/boca-web.postinst
+++ b/debian/boca-web.postinst
@@ -1,22 +1,56 @@
#!/bin/bash
+set -e
. /usr/share/debconf/confmodule
-chown -R www-data.www-data /var/www/boca
+chown -R www-data:www-data /var/www/boca
chmod -R go-rwx /var/www/boca/src/private
+# Stop the apache2 server before changing enabled modules
+systemctl stop apache2
+
+# Configure HTTPS in Apache
+# See https://www.arubacloud.com/tutorial/how-to-enable-https-protocol-with-apache-2-on-ubuntu-20-04.aspx
+# Enable SSL module
+a2enmod ssl
+
+# Enable default SSL Virtual Host
+a2ensite default-ssl
+
+# Enable boca HTTP Virtual Host
+a2ensite 000-boca.conf
+
+# Enable apache's shared object cache provider that uses a high-performance
+# cyclic buffer inside a shared memory segment
+# See https://httpd.apache.org/docs/2.4/socache.html
a2enmod socache_shmcb
-a2enmod proxy_fcgi
-# Make sure embedded apache php module is not loaded
-a2dismod php7.4 || true
+# Recommended setup before enabling the php-fpm with apache httpd 2.4: enable
+# fast CGI and set its environment variables
+# Older tutorials recommended disabling the mpm_prefork module and enabling the
+# mpm_event one before setting Fast CGI up, e.g.
+# https://askubuntu.com/questions/1319861/how-to-configure-apache-http-to-php-fpm-on-ubuntu-20-10
+# Fortunately, Apache HTTPD version 2.4 already enables the mpm_event by default
+# according the project's documentation
+# https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM
+a2enmod proxy_fcgi setenvif
+
+# Enable php-fpm module for apache
+a2enconf php8.1-fpm
+
+# Check the syntax of apache2's configuration file
+# This DOES NOT CATCH ALL ERRORS
+apache2ctl configtest
+
+# Restart apache2 with the new configuration
+systemctl start apache2
-#enable php fpm instead
-a2enconf php7.4-fpm
+# Remember to reset possible stored password from debconf
+db_reset boca-common/dbpassword
-service apache2 restart || true
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
-#remember to reset possible stored password from debconf
-db_reset boca-common/dbpassword || true
+#DEBHELPER#
exit 0