06 8月 2009

Apache2 + SSL on Ubuntu 8.10

主要是參照SSL on Ubuntu 8.10 Apache2

(1)Open Apache SSL Module
sudo a2enmod ssl
(2)Create server's private key and certificate
cd /etc/apache2
sudo openssl genrsa -des3 -out server.key 1024
sudo openssl req -new -key server.key -out server.csr
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
這時會問些國家、公司之類的問題,照著回答就OK了,回答的資料會顥示在Browser的憑證清單裡
(3)Install the key and certificate:
sudo cp server.crt /etc/ssl/certs/
sudo cp server.key /etc/ssl/private/
(4)Edit default-ssl configuration
sudo vim /etc/apache2/sites-available/default-ssl
add
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
(5)Enable default-ssl and restart apache2
sudo a2ensite default-ssl
sudo /etc/init.d/apache2 restart

沒有留言: