L'Antre du Tryphon
This post contains notes to install Apache2, MySQL and PHP on a Ubuntu Server 22.04. This is not a tutorial but a checklist.
Install the required softwares
apt-get install apache2
service apache2 status
apt-get install mysql-server
service mysql status
mysql_secure_installation
CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'www';
create database www;
GRANT ALL PRIVILEGES ON www.* TO 'phpbb'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
apt-get install php8.1-fpm php8.1 libapache2-mod-php8.1 php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl php8.1-bcmath php-json php-mbstring php-xml
apt-get install unzip
upload_max_filesize = 32M
post_max_size = 48M
memory_limit = 256M
max_execution_time = 120
max_input_vars = 300
max_input_time = 1000
a2dissite 000-default
chown -R www-data:www-data /var/www/html/newsite
find /var/www/html/newsite -type d -exec chmod 755 {} \;
find /var/www/html/newsite -type f -exec chmod 644 {} \;
apt-get install apache2-utils
htpasswd -c /etc/apache2/.htpasswd exampleuser
<VirtualHost *:80> ServerAdmin admin@newsite.com ServerName www.newsite.com ServerAlias www.newsite.com DocumentRoot /var/www/html/newsite <Directory /var/www/html/newsite> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin admin@newsite.com ServerName www.newsite.com ServerAlias www.newsite.com SSLEngine on DocumentRoot /var/www/html/newsite <Directory /var/www/html/newsite> Options -Indexes +FollowSymLinks AuthType Basic AuthName "Restricted Content: You are not welcome!" AuthUserFile /etc/apache2/.htpasswd Require valid-user </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLCertificateFile /etc/letsencrypt/live/www.newsite.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/www.newsite.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>
a2enmod ssl
ena2site newsite