Académique Documents
Professionnel Documents
Culture Documents
http://hostname
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
The command prompts you to enter the hostname to use in the certificate. Once done, you can
now see that there is a new file in the /etc/apache2/ssl directory:
drwxr-xr-x 2 root root 4096 2011-12-16 14:40 ./
drwxr-xr-x 8 root root 4096 2011-12-16 14:12 ../
lrwxrwxrwx 1 root root 10 2011-12-16 14:40 a9630d61 -> apache.crt
-rw- 1 root root 2685 2011-12-16 14:40 apache.crt
That last command will have generated an apache.crt file that contains both the certificate and
the key. Lets now separate that file into two files:
3|Page
I will simply copy the original apache.crt file twice, one with each name and edit each file.
#cd /etc/apache2/ssl
#cp apache.crt apache.pem
#cp apache.crt apache.key
The apache.pem file must contain everything from the beginning line to the ending line of the certificate
-----BEGIN CERTIFICATE----...
-----END CERTIFICATE----The apache.key file must contain everything from the beginning line to the ending line of the key
-----BEGIN PRIVATE KEY----...
-----END PRIVATE KEY-----
Final test
To check that everything works fine, lets try to access the page at http://localhost with curl
curl http://localhost curl: (7) couldn't connect to host
Lets no try to access the page at https://localhost with curl -k. The -k is used to allow
connections from sites without a certificate.
# curl -k https://localhost</pre>
<h1>It works!</h1>
<pre>
This is the default web page for this server.
The web server software is running but no content has been added, yet.
=============================================end====================================
5|Page
/etc/apache2/sites-enabled/drupal6
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
UseCanonicalName Off
ServerAdmin webmaster@localhost
DocumentRoot /usr/share/drupal6/
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/cert.pem
ServerAdmin webmaster@localhost
DocumentRoot /usr/share/drupal6/
</VirtualHost>
<Directory /usr/share/drupal6/>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>
6|Page
/etc/apache2/sites-enabled/phpmyadmin
<VirtualHost *:12322>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/cert.pem
ServerAdmin webmaster@localhost
DocumentRoot /usr/share/phpmyadmin/
</VirtualHost>
<Directory /usr/share/phpmyadmin>
Options Indexes FollowSymLinks
DirectoryIndex index.php
<Files setup.php>
Deny from all
</Files>
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
</IfModule>
</Directory>
7|Page