Introduction

Drupal is an open-source content management system (CMS) that is widely used for creating websites and web applications. In this guide, we will show you how to install Drupal CMS with Apache web server and configure Free Let’s Encrypt SSL on a Windows VPS.

Prerequisites

Before proceeding with the installation, ensure that you have the following prerequisites:

  • A Windows VPS with administrative privileges.
  • Windows Server 2016 or later, or Windows 10/11.
  • Internet connection to download the necessary packages.
  • Basic knowledge of using PowerShell or Command Prompt.

Step 1: Install Apache Web Server

To run Drupal CMS, you need to install Apache on your system. Follow these steps:

  1. Download the Apache HTTP server from the official website: Apache HTTP Server Downloads.
  2. Run the installer and follow the instructions to install Apache on your Windows VPS.
  3. After installation, open Command Prompt as Administrator and start the Apache service using the following command:
    httpd -k start
  4. To ensure Apache is working, open a web browser and navigate to http://localhost. You should see the Apache test page.

Step 2: Install PHP

Drupal CMS requires PHP. Install PHP by following these steps:

  1. Download PHP for Windows from the official website: PHP for Windows.
  2. Extract the downloaded PHP archive to a directory, e.g., C:\php.
  3. Edit the Apache configuration file (httpd.conf) to add PHP support. Open the file in a text editor and add the following lines:
    # PHP module configuration
    LoadModule php_module "C:/php/php7apache2_4.dll"
    AddHandler application/x-httpd-php .php
    PHPIniDir "C:/php"
                        
  4. Restart Apache by running the following command in Command Prompt:
    httpd -k restart

Step 3: Install MySQL or MariaDB

Drupal requires a database to store content and configuration. You can use MySQL or MariaDB. Follow these steps:

  1. Download MySQL from the official website: MySQL Downloads.
  2. Run the installer and follow the instructions to install MySQL on your Windows VPS.
  3. After installation, start the MySQL service and set a root password.
  4. Alternatively, you can install MariaDB, which is a drop-in replacement for MySQL: MariaDB Downloads.

Step 4: Download and Install Drupal CMS

Now, you can download and install Drupal CMS on your system:

  1. Download the latest version of Drupal from the official website: Drupal Downloads.
  2. Extract the downloaded Drupal archive to the web root directory, usually C:\Apache24\htdocs\.
  3. Rename the extracted folder to drupal.

Step 5: Configure Apache Virtual Host

You need to configure Apache to serve Drupal. Edit the Apache configuration file (httpd.conf) and add a VirtualHost entry:

    DocumentRoot "C:/Apache24/htdocs/drupal"
    ServerName yourdomain.com
    DirectoryIndex index.php
    <Directory "C:/Apache24/htdocs/drupal">
        AllowOverride All
        Require all granted
    

            

Save the changes and restart Apache:

httpd -k restart

Step 6: Configure the Database for Drupal

Next, create a MySQL database for Drupal:

  1. Log in to MySQL:
    mysql -u root -p
  2. Create a new database for Drupal:
    CREATE DATABASE drupal_db;
  3. Create a new user and grant permissions:
    CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON drupal_db.* TO 'drupal_user'@'localhost';

Step 7: Install Let’s Encrypt SSL Certificate

To secure your site, you can use a free SSL certificate from Let’s Encrypt. Follow these steps:

  1. Download and install win-acme, a Let’s Encrypt client for Windows.
  2. Run the following command in PowerShell:
    .\wacs.exe --target manual --host yourdomain.com --store pemfiles --validation http-01
  3. Follow the instructions to generate and install the SSL certificate.
  4. Configure Apache to use the SSL certificate by editing the httpd-ssl.conf file and adding the following lines:
    SSLEngine on
    SSLCertificateFile "C:/path/to/certificate.crt"
    SSLCertificateKeyFile "C:/path/to/private.key"
                        
  5. Restart Apache:
    httpd -k restart

Step 8: Complete the Drupal Installation

Now, open your browser and navigate to https://yourdomain.com to complete the Drupal installation:

  1. Follow the on-screen instructions to set up Drupal.
  2. Choose your language and configure the database connection (use the database, username, and password you created earlier).
  3. Complete the installation and configure your site settings.

Conclusion

Congratulations! You have successfully installed Drupal CMS with Apache and a free Let’s Encrypt SSL certificate on your Windows VPS. You can now start building your website or web application with Drupal’s powerful features.

© 2024 Your Company. All rights reserved.