How to Install Drupal with Apache and Let’s Encrypt SSL on Debian 11


Drupal is a well-liked open-source content material control device that lets you construct, set up, and deal with your web page’s content material with out a coding wisdom.

Many other content material control methods are obtainable on the net, however now not all are proper for each web page. If you wish to have to construct your web page with one thing versatile and strong, glance no additional than Drupal.

Here, we can see set up Drupal with Apache and Let’s Encrypt SSL on Debian 11.


Install LAMP Stack

Follow the beneath hyperlink to put in the LAMP stack to your Debian device for Drupal set up.

Install AMP (Apache, MariaDB, and PHP) on Debian 11

Install PHP Extensions for Drupal

Use the apt command to put in PHP extensions for Drupal set up.

sudo apt replace

sudo apt set up -y php-mysql php-gd php-dom php-curl php-imagick php-zip php-xml php-mbstring php-json php-pdo php-cli php-apcu

sudo apt set up --no-install-recommends -y php-uploadprogress

Configure PHP for Drupal

Drupal recommends you a couple of PHP configurations for the simpler efficiency of the web page. So, edit the /and so on/php/7.4/apache2/php.ini document and replace the beneath values. Not all values is also suitable for all web sites. But, you’ll be able to get started with the beneath values.

memory_limit = 256M

upload_max_filesize = 64M

post_max_size = 64M

realpath_cache_size = 256k

realpath_cache_ttl = 3600

sudo sed -i 's/memory_limit = .*/memory_limit = 256M/' /and so on/php/7.4/apache2/php.ini

sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 64M/' /and so on/php/7.4/apache2/php.ini

sudo sed -i 's/post_max_size = .*/post_max_size = 64M/' /and so on/php/7.4/apache2/php.ini

sudo sed -i 's/;realpath_cache_size = .*/realpath_cache_size = 256k/' /and so on/php/7.4/apache2/php.ini

sudo sed -i 's/;realpath_cache_ttl = .*/realpath_cache_ttl = 3600/' /and so on/php/7.4/apache2/php.ini

Setup Apache Virtual Host for Drupal

We will get started with making a digital host for a Drupal set up. You can to find all Apache digital hosts below /and so on/apache2/sites-available/ listing.

Typically, a digital host document comprises a ServerName, ServerAlias, Port quantity, Document root, log location, and so on.

I’m assuming the next,

Domain title: www.holhol24.internet
Port No: 80
Document root: /var/www/html/www.holhol24.internet

First, create a digital host configuration document.

sudo nano /and so on/apache2/sites-available/www.holhol24.internet.conf

Then, position the next knowledge into the above configuration document. Change the values as in keeping with your requirement.

   ServerName holhol24.internet
   ServerAlias www.holhol24.internet
   ServerAdmin admin@holhol24.internet
   DocumentRoot /var/www/html/www.holhol24.internet

   ErrorLog ${APACHE_LOG_DIR}/www.holhol24.net_error.log
   CustomLog ${APACHE_LOG_DIR}/www.holhol24.net_access.log blended

      Options FollowSymlinks
      AllowOverride All
      Require all granted

      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Create a listing for putting Drupal recordsdata.

sudo mkdir -p /var/www/html/www.holhol24.internet/

Enable the web site and Apache modules (SSL and rewrite).

sudo a2ensite www.holhol24.internet 

sudo a2enmod rewrite ssl

Restart the Apache carrier.

sudo systemctl restart apache2

Install Let’s Encrypt SSL Certificate

Create DNS Record

Go in your area registrar and create an A and CNAME (not obligatory if you do not need to make use of www subdomain) file in your area.

  1. Non-www Domain Name (Ex. holhol24.internet) >> A file level in your server IP
  2. www Domain Name (Ex. www.holhol24.internet) >> CNAME file level to holhol24.internet

For this demo, I can create two data in order that my Drupal web page will likely be obtainable at www.holhol24.internet.

DNS Records

Install Certbot shopper

The Certbot shopper that is helping generate and set up the Let’s Encrypt certificates is now obtainable as a snap package deal for Debian. So, first, set up snapd daemon to your device.

sudo apt replace

sudo apt set up -y snapd

Then, replace snapd to the most recent model.

sudo snap set up core && sudo snap refresh core

Finally, set up the Certbot shopper the usage of the beneath command.

sudo snap set up --classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

Install SSL Certificate

Use the beneath command to generate and set up the Let’s Encrypt SSL certificates within the Apache webserver.

sudo certbot --apache

1. Enter e-mail deal with to obtain notification on pressing renewal and safety notices
2. Type Y and press Enter to check in with the ACME server
3. Type Y or N to obtain emails about EFF information, campaigns, e-newsletter.
4. Certbot will routinely discover the area and ask you to turn on HTTPS in your Drupal web page. Type 1 or suitable numbers separated by way of a comma if you have a couple of web sites.

Which names do you want to turn on HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: holhol24.internet
2. www.holhol24.internet
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the suitable numbers separated by way of commas and/or areas, or go away enter
clean to choose all choices proven (Enter 'c' to cancel): 1,2

Wait for the SSL set up to finish.

Redirect non-www HTTP requests to www HTTPS with Apache

The Certbot shopper will position the desired regulations to redirect the visitors from HTTP to the HTTPS web page.

1. http://holhol24.internet >> https://holhol24.internet

2. http://www.holhol24.internet >> https://www.holhol24.internet

As you’ll be able to see, the primary area isn’t attaining www HTTPS with regulations positioned by way of Certbot. So, you’ll have to upload a rule manually to redirect visitors from non-www HTTP to www HTTPS area, I.e., http://holhol24.internet >> https://www.holhol24.internet if required.

Auto-Renew SSL Certificate

The Certbot shopper comes with systemd for auto-renewal of SSL certificate. So, you are going to now not must renew the certificate manually.

Install Drupal with Apache

Create Database for Drupal

First, login into MariaDB/MySQL database server.

sudo mysql -u root -p

Then, create the database for Drupal set up together with the database person and password.


CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';


Download Drupal Package

Download the current model of the Drupal installer the usage of the beneath command.

wget -O drupal-latest.tar.gz

Then, extract the downloaded document.

tar -zxvf drupal-latest.tar.gz

And then, transfer the recordsdata in your web page record root listing.

sudo mv drupal-*/* /var/www/html/www.holhol24.internet/

Update the possession and a gaggle of the Drupal web page listing.

sudo chown -R www-data:www-data /var/www/html/www.holhol24.internet/

Install Drupal CMS

Open your browser and seek advice from your Drupal area to accomplish the Drupal set up.


1. Choose Language in your Drupal set up and web page after which click on Save and proceed

2. Select an set up profile this is appropriate for you after which click on Save and proceed

3. You would possibly get Clean URLs Test – False Negatives on Verify necessities web page. So, you’ll be able to forget about it should you get a caution that CLEAN URLS is Disabled. Click the Continue anyway hyperlink on the backside to continue.

4. Enter the Drupal database main points within the Database configuration web page after which click on Save and proceed

5. Wait for the Drupal set up to finish

6. You will wish to Configure web site by way of getting into Site Information, Site Maintenance Account, Region Settings, and Update Notifications. Finally, click on Save and proceed

7. Upon of entirety, the installer will redirect you to the Drupal back-end to regulate the set up. Alternatively, you’ll be able to get entry to the Drupal back-end by way of going to https://your-drupal-website/person/login

Access Drupal Website

Now, it is possible for you to to get entry to the web site along with your area title.



Screenshot of Drupal CMS Back-End:


After putting in Drupal, it is important to allow the Trusted Host Settings to offer protection to your Drupal web page in opposition to HTTP HOST Header assaults.


That’s All. I’m hoping you might have discovered set up Drupal with Apache and Let’s Encrypt SSL on Debian 11.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More