Linux и серверы

Enable SSL for apache server in 5 minutes –

Материал перенесён из старой базы знаний ATC-IP и оформлен в едином стиле нового сайта.

I now got a small place on the web
Menu
Close
Home
ArduiPi
Presentation
Getting Started
Protocol Specification
Test Board
Test Procedure
RFM12B on ArduiPi
ULPNode
Presentation
Bootloader Part 1
Bootloader Part 2
New Forums
About
26
Enable SSL for apache server in 5 minutes
Posted on
October 16, 2012
by
Charles
This post describe how to quickly enable SSL for apache web server under linux. This has been done on a clouded virtual machine, the Linux distribution is Ubuntu 12.04 LTS Server, the one provided by Amazon Aws or Microsoft Azure. This procedure may not work or may differ on older or different distribution.
What need to be in place ?
You need to already have apache server running on http port 80 (or whatever) and when you try to go to your website for example
http://demo.hallard.me
you should have the well know page
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
Once this is ok, just go to your server with ssh
What do to ?
Ok let’s start where we will put the certificates (in /etc/apache2/ssl)
Shell
sudo mkdir /etc/apache2/ssl
sudo
mkdir
etc
apache2
ssl
now we generate the certicates, for 3 years (1095 days) under the folder we created above.
Shell
sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key
sudo
openssl
req
x509
nodes
days
1095
newkey
rsa
2048
out
etc
apache2
ssl
server
.crt
keyout
etc
apache2
ssl
server
.key
that will show the following, and ask you some questions.
Generating a 2048 bit RSA private key
............................................+++
.....................+++
writing new private key to '/etc/apache2/ssl/server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:Poitou
Locality Name (eg, city) []:Montamise
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Internet Self CA
Organizational Unit Name (eg, section) []:IT
Common Name (e.g. server FQDN or YOUR name) []:demo.hallard.me
Email Address []:mydummy@email.com
10
11
12
13
14
15
16
17
18
19
Generating a 2048 bit RSA private key
............................................+++
.....................+++
writing new private key to '/etc/apache2/ssl/server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:Poitou
Locality Name (eg, city) []:Montamise
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Internet Self CA
Organizational Unit Name (eg, section) []:IT
Common Name (e.g. server FQDN or YOUR name) []:demo.hallard.me
Email Address []:mydummy@email.com
The most important, is the Common Name, it should match the internet name FQDN (here demo.hallard.me)
Now we install the SSL mod for apache, this instruction pre configure the file /etc/apache2/ports.conf with some line and the important one that say
Listen 443
Shell
sudo a2enmod ssl
Позвонить +7 (343) 382-33-16