Moaz Ateeq
Moaz Ateeq

Reputation: 397

How to configure SSL in Apache on local server in Linux?

Can any one send me the good link for configuration of SSL in Apache on local server.I searched on google but did not find the any complete method for local apache server. Thanks

Upvotes: 0

Views: 753

Answers (3)

Tanyo Ivanov
Tanyo Ivanov

Reputation: 118

I think that's the tutorial you need

Steps:

sudo a2enmod ssl

sudo service apache2 restart

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

sudo nano /etc/apache2/sites-available/default-ssl.conf

  • Replace the content with the content from the Tutorial.

  • Basicly for a new website, just copy the file and change the name of the folder and host

sudo ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/

sudo service apache2 restart

It worked for me

Upvotes: 0

Dhivin
Dhivin

Reputation: 706

Install openssl:

sudo apt-get install openssl

Create directory to save certificate:

sudo mkdir /etc/apache2/ssl

sudo mkdir /etc/apache2/ssl/certs

sudo mkdir /etc/apache2/ssl/private

enable ssl module in apache

sudo a2enmod ssl

go to cd /etc/apache2/ssl/private

openssl req -newkey rsa:2048 -nodes -keyout website_ssl.key -out website_ssl.csr -sha256

u will get two files .csr and .key

download your ssl by uploading your csr to your ssl provider and once certificate issued download the files to

cd /etc/apache2/ssl/certs

open sudo nano /etc/apache2/sites-available/default-ssl.conf

 SSLCertificateFile /etc/apache2/ssl/example.in/certs/
 SSLCertificateKeyFile /etc/apache2/ssl/example.in/
 SSLCertificateChainFile /etc/apache2/ssl/example.in/certs/

add .key .csr and gb_bundle.csr in apache2

to enable

sudo a2ensite default-ssl.conf

sudo service apache2 restart

Upvotes: 2

ihor_dvoretskyi
ihor_dvoretskyi

Reputation: 582

If you meant setting up apache for using HTTPS, you may follow the next tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-with-a-free-signed-ssl-certificate-on-a-vps

Upvotes: 0

Related Questions