• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Apache for Newbie: Set up Apache with mod_ssl

December 17, 2023

Apache for Newbie: Set up Apache with mod_ssl

When it comes to hosting a website, Apache is one of the most popular and widely used web servers. It is known for its flexibility, reliability, and security. In this article, we will guide you through the process of setting up Apache with mod_ssl, which is an Apache module that provides support for secure connections using the SSL/TLS protocols.

What is mod_ssl?

Mod_ssl is an Apache module that provides strong cryptography for the Apache web server via the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols. It allows you to secure your website by encrypting the data transmitted between the server and the client, ensuring the confidentiality and integrity of the communication.

Step 1: Install Apache

The first step is to install Apache on your VPS. If you are using a Linux-based operating system, you can use the package manager to install Apache. For example, on Ubuntu, you can run the following command:

sudo apt-get install apache2

Once the installation is complete, you can start Apache by running the following command:

sudo systemctl start apache2

You can verify that Apache is running by visiting your VPS’s IP address in a web browser. You should see the default Apache page.

Step 2: Install mod_ssl

Next, you need to install the mod_ssl module for Apache. Again, you can use the package manager to install it. On Ubuntu, you can run the following command:

sudo apt-get install libapache2-mod-ssl

After the installation is complete, you need to enable the module by running the following command:

sudo a2enmod ssl

Finally, restart Apache to apply the changes:

sudo systemctl restart apache2

Step 3: Generate SSL Certificate

Now that mod_ssl is installed and enabled, you need to generate an SSL certificate for your website. There are different ways to obtain an SSL certificate, but one of the most common methods is using Let’s Encrypt, which provides free SSL certificates.

To install Let’s Encrypt, you can follow their official documentation. Once installed, you can generate a certificate for your domain by running the following command:

sudo certbot --apache

Follow the prompts to generate the certificate. Let’s Encrypt will automatically configure Apache to use the certificate.

Step 4: Configure Apache with mod_ssl

After generating the SSL certificate, you need to configure Apache to use mod_ssl. Open the Apache configuration file using a text editor:

sudo nano /etc/apache2/sites-available/default-ssl.conf

Inside the file, you will find the SSL configuration directives. Make sure the following lines are present:

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/your_domain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/your_domain/privkey.pem

Replace “your_domain” with your actual domain name. Save the file and exit the text editor.

Next, enable the SSL virtual host by running the following command:

sudo a2ensite default-ssl.conf

Finally, restart Apache to apply the changes:

sudo systemctl restart apache2

Summary

Setting up Apache with mod_ssl is essential for securing your website and protecting the data transmitted between the server and the client. In this article, we covered the steps to install Apache, install and enable mod_ssl, generate an SSL certificate using Let’s Encrypt, and configure Apache to use mod_ssl. By following these steps, you can ensure that your website is encrypted and secure.

Remember, if you are looking for reliable and secure VPS hosting in the Hong Kong, consider Hong Kong VPS Hosting. With Server.HK, you can host your website on high-performance servers with excellent support and affordable pricing.

Recent Posts

  • Top 5 Use Cases for a Hong Kong Dedicated Server in 2026
  • Hong Kong VPS vs Japan VPS: Head-to-Head for Asia-Pacific Deployments in 2026
  • Hong Kong VPS vs Singapore VPS: Which Is Better for Your Asia Business in 2026?
  • How to Migrate from CentOS 8 to AlmaLinux or Rocky Linux Safely
  • CentOS Server Performance Tuning: Optimization Techniques for 2026

Recent Comments

No comments to show.

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot