1. We need install Apache2.2 first, which is 2.2.4.3 version including SSL sudo apt--get install apache2 Or you can install it from SPM manager.
2. setup SSL certification
There is bug in this release "apache2-ssl-certificate: command not found", so I tried using /usr/sbin/make-ssl-cert. But the key file apache.pem is not stored. What i done is:
sudo mkdir /etc/apache2/ssl sudo openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem answer the questions:
I put CommonName or hostName to admin.domain.com 3. Configration sudo a2enmod ssl
I want to setup rewrite rule so:
sudo a2enmod rewrite
sudo cp /etc/apache2/sites-available/default
/etc/apache2/sites-available/ssl
modified these two files:
"default" file:
NameVirtualHost *:80
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteLog "/var/log/apache2/rewrite.log"
"ssl" file:
NameVirtualHost *:443
ServerAdmin webmaster@localhost
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
DocumentRoot /var/www/
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# Commented out for Ubuntu
#RedirectMatch ^/$ /apache2-default/
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
After then: sudo a2ensite ssl4. set serverName in apache2.conf
add line like: ServerName admin.domain.com the name is the same as in your certification key file.
5. all done sudo /etc/init.d/apache2 force-reload
OR sudo /etc/init.d/apache2 restart
6 some bug already fixed in next version Ubuntu and you can see the message
in error.log