---
title: "How to Secure Apache With HTTPS"
description: "Hypertext Transfer Protocol Secure (HTTPS) = HTTP + SSL/TLS Check list: apache sever openssl Steps: For Ubuntu 10.04/Apache."
url: "https://h3manth.com/scribe/how-secure-apache-https/"
canonical_url: "https://h3manth.com/scribe/how-secure-apache-https/"
markdown_url: "https://h3manth.com/scribe/blog/how-secure-apache-https.md"
publishDate: "2009-11-14T00:00:00.000Z"
author: "Hemanth HM"
category: "linux"
tags: ["ubuntu","web"]
word_count: 291
reading_time_minutes: 2
x_markdown_tokens: 646
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# How to Secure Apache With HTTPS

> Hypertext Transfer Protocol Secure (HTTPS) = HTTP + SSL/TLS Check list: apache sever openssl Steps: For Ubuntu 10.04/Apache.

**Hypertext Transfer Protocol Secure (HTTPS) = HTTP + SSL/TLS** **Check list:** __apache sever__ _openssl_ **Steps:** ` **For Ubuntu 10.04/Apache 2.2.14 changes suggested oregonbob:**[here](http://docs.google.com/View?id=dd6rgncr_151cxvhkpc5)`

Step 1 : _Create a self-signed certificate._ This include : Generate a key, Signing and avoid password **openssl genrsa -des3 -out my.key 4096 openssl req -new -key my.key -out my.csr openssl x509 -req -days 365 -in my.csr -signkey my.key -out my.crt openssl rsa -in my.key -out my.key.insecure mv my.key server.key.secure mv my.key.insecure my.key** Step 2 : _Setting up apache to detect the certificates_ **Create ssl dir in /etc/apache2 or the apache home dir. cd /etc/apache2 ; mkdir ssl** **Copy the _.crt and_.key to this dir cp my.key /etc/apache2/ssl cp my.crt /etc/apache2/ssl ** Step 3 : _Enable ssl_ **a2enmod ssl** Step 4 : _Create symblinks and stub SSL conf_ **cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl** Step 5 : _Set up the document roots, optional can be default /var/www or :_ **cd /var/www mkdir html cd /var mkdir wssl cd wssl mkdir html** Step 6 : _Configure virtual hosts._ **sudo su cd /etc/apache2/sites-available cp /etc/apache2/sites-available/default default_original** Step 7 : _Configure ports_ **HTTP over port 80 (edit /etc/apache2/sites-available/default): NameVirtualHost _:80 (Note: Look down just a bit and make a change to the virtual host settings.) ServerName localhost DocumentRoot /var/www/html/ HTTPS over port 443 (edit /etc/apache2/sites-available/ssl): NameVirtualHost _:443  ServerName localhost DocumentRoot /var/www-ssl/html/ P.S : Change localhost to your ip, if required.** Step 7 : _Order apache to listen on port 443_ **edit /etc/apache2/ports.conf and type in "Listen 443" with out quotes and save** Step 8 : _Turn on the SSL engine._ **edit /etc/apache2/sites-available/ssl and add the lines below: SSLEngine On SSLCertificateFile /etc/apache2/ssl/server.crt SSLCertificateKeyFile /etc/apache2/ssl/server.key** Step 9 : _Final step, restart apache and test_ **/etc/init.d/apache2 restart In browser : https://localhost must work**
