• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » HTTPS in Ubuntu PC localhost with OpenSSL

By Abhishek Ghosh October 26, 2012 10:36 am Updated on October 26, 2012

HTTPS in Ubuntu PC localhost with OpenSSL

Advertisement

HTTPS in Ubuntu PC localhost with OpenSSL is more easier to set up than on Windows 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 basic 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 :

 

Vim
1
sudo apt-get install apache2

 

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

Advertisement

---

 

Vim
1
http://localhost/

 

You will see the default Apache2 message – It Works!

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

 

Vim
1
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 enable SSL :

 

Vim
1
sudo a2enmod ssl

 

Then force restart Apache2 :

 

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

 

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

 

Vim
1
2
3
cd /etc/apache2
 
sudo openssl genrsa -des3 -out server.key 1024

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

Vim
1
sudo openssl genrsa  -out server.key 1024

 

Run this command for certificate request :

 

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

 

HTTPS in Ubuntu PC localhost with OpenSSL

 

Create a self signed certificate :

Vim
1
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 :

 

Vim
1
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 :

 

Vim
1
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 :

 

Vim
1
gksudo gedit httpd.conf

 

This step should normally enable https on your localhost.

Tagged With ssl for localhost ubuntu , openssl ubuntu 18 SSL_CTX_use_certificate , sudo cp server crt /etc/ssl/certs sudo cp server key /etc/ssl/private , ubuntu https at localhost?
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to HTTPS in Ubuntu PC localhost with OpenSSL

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • HTTPS in WAMP Server on Windows PC localhost with OpenSSL

    HTTPS in WAMP Server on Windows PC localhost with OpenSSL is quite easy to setup if you follow our step by step guide. You will get self signed certificate.

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • Install Elastic Stack on Ubuntu 16.04, CentOS 7 Single Cloud Server

    Here is How to Install Elastic Stack on Ubuntu 16.04, CentOS 7 on Single Cloud Server Instance For Server Log Analysis, Big Data Processing.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

vpsdime

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cloud-Powered Play: How Streaming Tech is Reshaping Online GamesSeptember 3, 2025
  • How to Use Transcribed Texts for MarketingAugust 14, 2025
  • nRF7002 DK vs ESP32 – A Technical Comparison for Wireless IoT DesignJune 18, 2025
  • Principles of Non-Invasive Blood Glucose Measurement By Near Infrared (NIR)June 11, 2025
  • Continuous Non-Invasive Blood Glucose Measurements: Present Situation (May 2025)May 23, 2025
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2026 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy