aboutsummaryrefslogtreecommitdiff
path: root/debian/boca-web.postinst
blob: 824654c294a22bb9179bd71b406993c4cb280ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e

. /usr/share/debconf/confmodule

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

# Ensure that apache's embedded php module is not loaded
a2dismod php8.1

# 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 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

# 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

# Remember to reset possible stored password from debconf
db_reset boca-common/dbpassword

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0