Skip to main content

Posts

Showing posts with the label Apache2

Install ModSecurity with Apache on Debian

OS: Debian 12 Steps 1: Install Apache2  sudo apt update sudo apt install apache2 Step 2: Install ModSecurity with Apache on Debian/Ubuntu The ModSecurity module for Apache is included in the default Debian/Ubuntu repository. To install it, run sudo apt install libapache2-mod-security2 Then enable this module. sudo a2enmod security2 Restart Apache for the change to take effect. sudo systemctl restart apache2 Step 3: Configure ModSecurity Check  /etc/apache2/mods-enabled/security2.conf In the above configuration file, you can find the following line. Make sure its exists IncludeOptional /etc/modsecurity/*.conf And copy example configuration file into /etc/modsecurity/modsecurity.conf mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf Find the following configuration and then change like below: #SecRuleEngine DetectionOnly SecRuleEngine On Step 4: Enable the Latest Rule Set to be continued Ref: https://www.linuxbabe.com/security/modsecurity-apache-debian-ub

Cara redirect http ke https di Apache2 Debian

Cari config default virtual host nya, contoh di debian biasanya terletak di config dibawah ini: root@server-www:/etc/apache2/sites-available# vim 000-default.conf atau bisa sesuikan nama virtualhost yang mau diredirect, misal your-site-default.conf tambahkan dipaling bawah saja, contoh config: untuk redirect config yang terbold <VirtualHost *:80>            ServerAdmin webmaster@localhost         DocumentRoot /var/www/html         ErrorLog ${APACHE_LOG_DIR}/error.log         CustomLog ${APACHE_LOG_DIR}/access.log combined                  Redirect permanent / https://bagussa.my.id/ </Virtualhost> root@server-www:/etc/apache2/sites-available# systemctl restart apache2 Okey silakan dicek seharusnya ketika mengakses http://your-site.com langsung ke redirect ke https//your-site.com