2016-11-23 15 views
1

我真的是一個前端開發人員,所以服務器配置對我來說是一個非常新的領域,對不起,如果這是一個簡單的問題!certbot-auto/letsencrypt爲指向同一服務器的多個域設置一個密鑰

我遇到了一些麻煩,試圖讓我的certbot-auto爲多個域生成一個SSH密鑰,指向一個盒子。

我有3-4個域(domain1.net,domain2.io,domain3.me,domain4.codes),它們都指向相同的數字海洋液滴。

此前(幾個月前),我曾試圖直接與letsencrypt(當時沒有certbot)。不知何故,我的SSL爲我的所有域名工作,但他們最近過期了,我現在似乎只能續訂domain1.net,而不是其他。

我嘗試下面的命令:

./certbot-auto certonly -a webroot --agree-tos -w /var/www/domain1.net/public_html/ \--expand -d domain1.net,www.domain1.net,domain2.io,www.domain2.io,domain3.me,www.domain3.me,domain4.codes,www.domain4.codes 

...這似乎工作,我有以下幾點:

| Saving debug log to /var/log/letsencrypt/letsencrypt.log    │ 
│ Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org  │ 
│ Cert not yet due for renewal           │ 
│ Renewing an existing certificate          │ 
│ Performing the following challenges:         │ 
│ http-01 challenge for domain1.net         │ 
│ http-01 challenge for www.domain1.net        │ 
│ http-01 challenge for domain2.io          │ 
│ http-01 challenge for www.domain2.io         │ 
│ http-01 challenge for domain3.me          │ 
│ http-01 challenge for www.domain3.me         │ 
│ http-01 challenge for domain4.codes         │ 
│ http-01 challenge for www.domain4.codes        │ 
│ Using the webroot path /var/www/domain1.net/public_html for   │ 
│ all unmatched domains.            │ 
│ Waiting for verification...           │ 
│ Cleaning up challenges            │ 
│ Generating key (2048 bits):           │ 
│ /etc/letsencrypt/keys/0012_key-certbot.pem       │ 
│ Creating CSR: /etc/letsencrypt/csr/0012_csr-certbot.pem 

IMPORTANT NOTES: 
- Congratulations! Your certificate and chain have been saved at 
    /etc/letsencrypt/live/domain1.net/fullchain.pem. Your cert 
    will expire on 2017-02-20. To obtain a new or tweaked version of 
    this certificate in the future, simply run certbot-auto again. To 
    non-interactively renew *all* of your certificates, run 
    "certbot-auto renew" 
- If you like Certbot, please consider supporting our work by: 

    Donating to ISRG/Let's Encrypt: https://letsencrypt.org/donate 
    Donating to EFF:     https://eff.org/donate-le 

..好,很好!然而,只有domain1.netwww.domain1.net似乎正在工作......其他域聲稱不使用HTTPS!

我在/etc/letsencrypt/live/目錄中也看到多個文件..我以前試圖讓這個工作(直接使用letsencrypt,而不是通過certbot),並讓它工作到今天,當它們過期並拒絕續訂時。這是我在目錄內看到的:

[email protected]:/opt$ sudo ls -la /etc/letsencrypt/live/ 
total 20 
drwx------ 5 root root 4096 Nov 22 18:22 . 
drwxr-xr-x 8 root root 4096 Nov 22 18:22 .. 
drwxr-xr-x 2 root root 4096 Nov 22 18:41 domain1.net 
drwxr-xr-x 2 root root 4096 Oct 16 00:00 domain1.net-0001 
drwxr-xr-x 2 root root 4096 Nov 22 18:22 www.domain1.net 

嗯..不知道爲什麼有多個條目。不應該只有一個?

無論如何 - 我不太熟悉HTTPS/keys/NginX來弄清楚這一點,並將我的頭髮撕掉。我只想讓我的SSL密鑰:

  1. 上述所有領域
  2. 自動更新通過certbot的自動更新

和不完全知道在哪裏我在這裏搞亂工作.. 。 任何幫助深表感謝!

編輯:這是我的服務器配置塊貌似nginx的:

server { 
# listen 80 default_server; 
# listen [::]:80 default_server ipv6only=on; 


    # START LETS ENCRYPT ADDITIONS: 
    listen 443 ssl; 
    server_name domain1.net www.domain1.net domain2.io www.domain2.io domain3.me www.domain3.me domain4.codes www.domain4.codes; 
    ssl_certificate /etc/letsencrypt/live/www.domain1.net/fullchain.pem; # managed by Certbot 
    ssl_certificate_key /etc/letsencrypt/live/www.domain1.net/privkey.pem; # managed by Certbot 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; 
    # /END LETS ENCRYPT ADDITION 

    root /var/www/domain1.net/public_html; 
    index index.php index.html index.htm; 

    # FOR LETSENCRYPT AUTO-RENEWAL, we must give it access to /.well-known 
    location ~ /.well-known { 
    allow all; 
    } 
    # /END LETSENCRYPT AUTO_RENEWAL 

    location/{ 
    # First attempt to serve request as file, then 
    # as directory, then fall back to displaying a 404. 
    try_files $uri $uri/ =404; 
    # Uncomment to enable naxsi on this location 
    # include /etc/nginx/naxsi.rules 
    } 

回答

0

只是想跟進 - 我得到了這個工作!

結果我的命令是正確的,但我濫用-d標誌 - 它需要分別應用於每個域。所以糾正命令:

./certbot-auto certonly -a webroot --agree-tos -w /var/www/domain1.net/public_html/ \--expand -d domain1.net,www.domain1.net -d domain2.io,www.domain2.io -d domain3.me,www.domain3.me -d domain4.codes,www.domain4.codes 
+0

太棒了!但是如果你有超過100個域名呢?你是否仍然可以通過1加密證書來完成這項工作?我明白如果你不知道答案。 – Karem

相關問題