HTTPS in Ubuntu PC localhost with OpenSSL


HTTPS in Ubuntu localhost with OpenSSL is more easier to set up than on PC with WAMP. All you want is to install Apache2 and some knowledge on SSL. If you are looking for HTTPS in WAMP Server on Windows PC, then read this guide instead. For setup of HTTPS in Ubuntu PC localhost with OpenSSL, you need LAMP set up.

 

HTTPS in Ubuntu PC localhost with OpenSSL : Basic Setup

 

Only follow these steps for the set up of HTTPS in Ubuntu PC localhost with OpenSSL if you have not installed Apache. A simple command will install Apache2 :

 

sudo apt-get install apache2

 

Open your browser and point to either localhost or your fixed static IP :

 

http://localhost/

 

You will the default Apache2 message – It Works!

If you need full LAMP server setup, this command instead :

 

sudo apt-get install lamp-server^

 

HTTPS in Ubuntu PC localhost with OpenSSL : The Steps for SSL

 

OpenSSL comes as default package with Apache2 in case of Ubuntu. You need not to install it separately. First SSL :

 

sudo a2enmod ssl

 

Then force restart Apache2 :

 

sudo /etc/init.d/apache2 force-reload

 

And create server key (note two commands are separate) :

 

cd /etc/apache2
sudo openssl genrsa -des3 -out server.key 1024

If above last command gives error later, try this command :


sudo openssl genrsa  -out server.key 1024

 

Run this command for certificate request :

 

sudo openssl req -new -key server.key -out server.csr

 

HTTPS in Ubuntu PC localhost with OpenSSL

 

Create a self signed certificate :

sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

 

Install them (note there are two separate commands) :

 

sudo cp server.crt /etc/ssl/certs/
sudo cp server.key /etc/ssl/private/

 

Go to :

 

cd /etc/apache2/sites-available

 

And open the needed file in graphical Gedit :

 

gksudo gedit default-ssl

 

Find and comment out three lines :

 

SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

 

Enable SSL, go to root to run this command :

 

sudo a2ensite default-ssl

 

Actually if you restart Apache2, it should work, but this adds a bit error in the auto config of httpd. So you might need to edit :

 

gksudo gedit httpd.conf

 

This step should normally enable https on your localhost.


Incoming search terms:

configure guacamole over apache,configure ssl guacamole,how to configure guacamole in step by step on ubuntu 12 04,openssl basics,openssl localhost lamp,openssl to localhost,tset up local host ubuntu
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
About Abhishek

Abhishek Ghosh is an Orthopedic Surgeon, Inventor with 216 Patents, Current editor of The Customize Windows Media Group. You can follow and know more about Dr. +Abhishek Ghosh on Google Plus and follow on Twitter as @AbhishekCTRL.

Speak Your Mind

*