Setting Up an SSL Website on CentOS/Ubuntu Without a Control Panel
Introduction
Secure Sockets Layer (SSL), or more accurately TLS (Transport Layer Security), encrypts communication between a user’s browser and your web server. Installing an SSL certificate ensures that data such as login credentials, payment information, and personal details are transmitted securely while also improving user trust and search engine rankings.
This guide explains how to manually configure an SSL-enabled website on CentOS or Ubuntu systems running Apache HTTP Server, without using a hosting control panel such as cPanel or Plesk.
Prerequisites
Before beginning the SSL installation, ensure you have the following:
- A server running CentOS or Ubuntu
- Apache HTTP Server installed
- Root or sudo access to the server
- A registered domain name pointing to the server’s public IP address
- An SSL certificate issued by a Certificate Authority (CA)
- The following SSL files:
- SSL Certificate (
.crt) - Private Key (
.key) - Intermediate/CA Bundle (
.caor.crt)
- SSL Certificate (
- OpenSSL and Apache SSL module (
mod_ssl) installed
Steps to Configure SSL
Step 1: Install Required Packages
CentOS
Install Apache SSL module and OpenSSL.
yum install mod_ssl openssl
Ubuntu
Install Apache packages.
apt-get install apache2 apache2-common
Enable the SSL module.
a2enmod ssl
Step 2: Generate a CSR and Obtain an SSL Certificate
Generate a Certificate Signing Request (CSR) and submit it to your Certificate Authority (CA).
After the certificate is issued, you should receive:
- SSL Certificate
- Private Key (generated during CSR creation)
- Intermediate/CA Certificate
Step 3: Configure the Apache Virtual Host
CentOS
Create a virtual host configuration file.
/etc/httpd/conf.d/example.com.conf
Ubuntu
Create the site configuration.
/etc/apache2/sites-available/example.com.conf
Enable the site.
a2ensite example.com
Add the SSL VirtualHost configuration.
<VirtualHost 192.168.1.56:443>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/example_com_www/
ServerName server1.example.com
ServerAlias www.example.com
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
SSLEngine on
SSLCertificateFile /etc/ssl/example.com.crt
SSLCertificateKeyFile /etc/ssl/example.com.key
SSLCACertificateFile /etc/ssl/example.com.ca
<Directory "/var/www/html/example_com_www/">
AllowOverride All
</Directory>
</VirtualHost>
Note: Modern Apache versions recommend using
<VirtualHost *:443>instead ofNameVirtualHost, asNameVirtualHosthas been deprecated.
Step 4: Store SSL Certificate Files
Create the SSL directory if it does not already exist.
mkdir -p /etc/ssl
Copy the certificate files into the directory.
| File | Example Location |
|---|---|
| SSL Certificate | /etc/ssl/example.com.crt |
| Private Key | /etc/ssl/example.com.key |
| Intermediate CA | /etc/ssl/example.com.ca |
Ensure that the private key is readable only by the root user.
chmod 600 /etc/ssl/example.com.key
Step 5: Restart Apache
CentOS
systemctl restart httpd
or
service httpd restart
Ubuntu
systemctl restart apache2
or
service apache2 restart
Step 6: Verify the SSL Website
Access the website using HTTPS.
https://your-domain.com
or
https://192.168.1.56:443
Check the following:
- The website loads successfully over HTTPS.
- The browser displays a secure padlock.
- The certificate is valid and trusted.
- No mixed-content warnings are present.
You can also verify the certificate using:
openssl s_client -connect your-domain.com:443
Important Notes
- Replace
192.168.1.56with your server’s actual IP address. - Replace
example.comwith your domain name. - Update the
DocumentRootto match your website location. - Ensure DNS records point your domain to the correct server IP before testing.
- Keep the private key secure and never share it publicly.
Conclusion
Configuring SSL manually on an Apache web server without a control panel involves installing the necessary SSL modules, obtaining an SSL certificate, configuring an HTTPS virtual host, placing the certificate files in the appropriate locations, and restarting the web server. Once completed, your website will be accessible over HTTPS, providing encrypted communication, improved security, and greater trust for users. Regularly monitor certificate expiration dates and renew certificates before they expire to maintain uninterrupted secure access.
