1.啟動ssl mod
sudo a2enmod ssl
2.建立放置ssl憑證的資料夾
sudo mkdir /etc/apache2/ssl
3.建立憑證,其中365代表有效時間為365天,指令後,填一些基本資料
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
4.修改apache2的設定
sudo vim /etc/apache2/sites-available/default
複製一份
<VirtualHost *:80>
..
..
..
</VirtualHost>
再改為
<VirtualHost *:443>
ServerName example.com:443
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
..
..
..
</VirtualHost>
5.啟用default
sudo a2ensite default
6.重啟apache2
sudo service apache2 restart
orsudo service apache2 reload
參考自:
How To Create a SSL Certificate on Apache for Ubuntu 12.04 | DigitalOcean: "sudo service apache2 reload"
'via Blog this'
沒有留言:
張貼留言