跳轉到內容
View in the app

A better way to browse. Learn more.

PHP論壇人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

安裝 acme.sh 做自動續簽SSL憑證 (更改為Google SSL憑證)

精選回覆

發表於

安裝 acme.sh 做自動續簽SSL憑證 (更改為Google SSL憑證)

這幾天關掉CF CDN,發現論壇被擋掉,瀏覽器顯示什麼錯誤訊息

原來是Let's Encrypt SSL憑證不能用了

https://github.com/acmesh-official/acme.sh

Letsencrypt.org CA 沒有支援了

0.png

我想想還是換為名氣大的Google SSL憑證

1.到Google網站,建立 專案 (projects),並記住它的專案ID

https://console.cloud.google.com/home/dashboard

1.png

2.png

2.進入Cloud Shell 終端機

3.png

4.png

5.png

6.png


執行以下指令

gcloud projects add-iam-policy-binding 你的專案ID \

--member=user:你的電子郵件位址 \

--role=roles/publicca.externalAccountKeyCreator

2.启用 Public CA API
gcloud services enable publicca.googleapis.com



3.要求 EAB 密鑰 和 HMAC 雜湊式訊息驗證碼,請執行下列指令:
gcloud publicca external-account-keys create


這個指令會傳回在 Public CA 的正式版環境中有效的 EAB 密碼。在回應主體中,keyId 欄位包含 EAB 金鑰 ID,b64MacKey 欄位則包含 EAB HMAC。
您必須在取得 EAB 密鑰後的 7 天內使用。如果未在 7 天內使用 EAB 密鑰,該密鑰就會失效。使用 EAB 密鑰註冊的 ACME 帳戶不會過期。

還原為實際工作環境的端點,請執行下列指令

如果你不是使用Google雲主機做論壇,在此就準備關掉瀏覽器Cloud Shell此頁面

gcloud config unset api_endpoint_overrides/publicca

4.在你論壇的伺服器,SSH連入

mkdir -p /var/www/域名.com/well-known

mkdir -p /var/www/域名.com/well-known/acme-challenge

cd /var/www/域名.com/



mv well-known .well-known



產生dhparam
mkdir -p /etc/nginx/ssl

openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam 2048



-------------------------------------
acme.sh 預設安裝在/root/ 目錄
-------------------------------------

curl https://get.acme.sh | sh -s email=你的電子郵件位址


重新載入
source ~/.bashrc


自動更新
acme.sh --upgrade --auto-upgrade


切換為使用 google ca
acme.sh --set-default-ca --server google


修改 域名.com.conf
vi /etc/nginx/sites-available/域名.com.conf



前面步驟有寫了幾行,現在都刪掉,更換為

server {
	listen 80;
	listen [::]:80;
                root /var/www/域名.com; 
                index index.html index.htm index.php; 
               server_name 域名.com;

	location /.well-known/acme-challenge {
		root /var/www/google;
	}

	location / {
		rewrite	^/(.*)$ https://$host/$1 permanent;
	}
}



ESC儲存並離開
:wq



重新載入Nginx
nginx -t


nginx -s reload







在acme.sh註冊帳號

acme.sh --register-account -m email --server google \

--eab-kid 輸入你的keyId \

--eab-hmac-key 輸入你的b64MacKey



正確的話,顯示如下
Account key creation OK.
Registering account: https://dv.acme-v02.api.pki.goog/directory
Registered
ACCOUNT_THUMBPRINT





接下來
mkdir -p /var/www/google



使用HTTP驗證簽發憑證

如果要申請多個域名,則是執行

acme.sh --issue -d 域名.com -d www.域名.com -w /var/www/google



等待執行完
直到出現 Cert success
Your cert is in: /root/.acme.sh/域名.com_ecc/域名.com.cer
Your cert key is in: /root/.acme.sh/域名.com_ecc/域名.com.key
The intermediate CA cert is in: /root/.acme.sh/域名.com_ecc/ca.cer
And the full-chain cert is in: /root/.acme.sh/域名.com_ecc/fullchain.cer




從上面得知,這是ECC憑證

安裝ECC憑證

acme.sh --install-cert --ecc -d 域名.com \



依次敲入


--key-file /etc/nginx/ssl/域名.com.key \

--fullchain-file /etc/nginx/ssl/fullchain.cer \

--reloadcmd "systemctl restart nginx"



成功的話,將顯示
Run reload cmd: systemctl restart nginx
Reload success

本文章最後於,由Jack編輯

建立帳號或登入後發表意見

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.