• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1071
  • Last Modified:

Enabling Https on CentOS 5.2

Hi Guys,

I need to enable https on my centOS server, but I have no clue on how to do that.

Can somebody help me... one step at a time, please.!

My Linux Knowledge is not so deep.

I need it because of the Google Sitemap Generator.
1 Solution
Hi there,

Please ensure you run all the below commands as root or with the correct sudo rights as well as the correct PATH configured.

In order to serve web content via a secure channel (https) you will need the following packages installed:

httpd: Apache HTTP Server
mod_ssl: Apache HTTP Server cryptography module
openssl: Implementation of SSL and TLS
      1) yum install httpd mod_ssl openssl

Then you'll need to do the following steps in order to generate the private key, a cert request and a self-signed cert using the private key and cert request just created.
      2) openssl genrsa -out private.key 1024
      3) openssl req -new -key private.key -out cert_request.csr
      4) openssl x509 -req -days 365 -in cert_request.csr -signkey private.key -out signed_certificate.crt

You then need to put the resulting files in the 'right' places:
      5) mv signed_certificate.crt /etc/pki/tls/certs/.
      6) mv private.key /etc/pki/tls/private/.
      7) mv cert_request.csr /etc/pki/tls/private/.

Then you need to let mod_ssl know where you have put them:
      8) vi +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf

Set this value (SSLCertificateFile) the same as where you placed the cert file:
      SSLCertificateFile /etc/pki/tls/certs/signed_certificate.crt

Then a few lines below this you'll find SSLCertificateKeyFile, set this to the following:
      SSLCertificateKeyFile /etc/pki/tls/private/private.key

Thats it.

Restart Apache and you should be good to go:
      9) /etc/init.d/httpd restart

If you are using iptables (you can find out by running /etc/init.d/iptables status) you'll need to add a rule to allow the traffic in:
      10) iptables -A INPUT -p tcp --dport 443 -j ACCEPT
      11) /etc/init.d/iptables save

Hope that this helps you on your way...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now