LAMP Server
Install a simple LAMP server on debian/ubuntu
hostnamectl set-hostname name.domain.tld
apt -y install net-tools sudo wget curl bash-completion
apt -y install apache2
apt -y install libapache2-mod-php8.1 php8.1 php8.1-gd php8.1-xml php8.1-curl php8.1-mbstring php8.1-xmlrpc
# For nextcloud add following line
apt-get install php8.1-intl php-imagick php8.1-xml php8.1-zip
apt -y install php8.1-mysql mariadb-server mariadb-client
systemctl start mariadb
mysql_secure_installation
mysql
MariaDB> use mysql;
MariaDB> update user set plugin='' where User='root';
MariaDB> flush privileges;
MariaDB> quit
a2enmod rewrite ssl
nano /etc/apache2/sites-enabled/000-default.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
nano /etc/apache2/sites-available/default-ssl.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
pico /etc/apache2/sites-available/default-ssl.conf
SSLProtocol all -SSLv2 -SSLv3
# Add SSL Cipher in one long line
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
SSLHonorCipherOrder on
SSLOptions +StrictRequire
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
a2enmod headers
systemctl restart apache2.service
apache2ctl –t
systemctl restart apache2.service mariadb.service
systemctl enable apache2.service mariadb.service
apt-get -y install certbot
apt-get -y install python-certbot-apache
certbot --authenticator webroot --installer apache
crontab -e
0 2 * * * certbot renew >> /var/log/letsencrypt.log