#sudo apt-get install dirmngr
#更新
sudo apt-get update
# 安裝軟體管理套件
sudo apt-get install software-properties-common
# 加入 certbot ppa repository,並透過 apt-get update 取得套件資訊
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
# 安裝 certbot for apache2
sudo apt-get install -y python3-certbot-apache
Now we are ready to install SSL Certificates. Execute the following command to install SSL Certificates.
Code
# 開始進行 Apache 的憑證安裝
sudo certbot --apache
After executing above command we need provie an email account. Please provide email which you used frequently. You will going to recieve SSL Certificate expiration emails on this email.
Next you need to Agree the Terms of Service
Confirmation for sharing your email with Electronic Frontier
Now we need to select domains for which we need to Install SSL Certificates.
Finally select How to handle http requests. We are going to recomended select option 2
sudo certbot --apache
到期時自動續訂ssl
sudo certbot renew --dry-run
設定信任網域名,讓drupal可以輸入www.jujula.org 或 jujula.org 連線,而不會被拒絕訪問。
打開
sudo nano /var/www/html/sites/default/settings.php
設定信任網域名
$settings['trusted_host_patterns'][] = '^www\.jujula\.org$'; # Added by Google C2D
$settings['trusted_host_patterns'][] = '^jujula\.org$'; # Added by Google C2D
sudo nano /var/www/html/.htaccess
把http轉為https
RewriteEngine on
# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
沒有留言:
張貼留言