LoginSignup
6
6

More than 3 years have passed since last update.

KUSANAGIでなぜかLet's Encryptが更新されなかったのを解決しようとしてみた件

Last updated at Posted at 2019-08-24

はじめに

 ConoHaVPSでKUSANAGI動かしてWordPress動かしてますが、なぜかhttpsで無効な証明書と出てきてしまいました。
 とりあえず回復までの道のりを書いていきます。

一体何が起こっていたのか?

 とにかく自分のWPサイトが証明書のエラーになるので、 /home/kusanagi/(省略)/DocumentRoot/ を調べたところ .well-known フォルダが無い事に気づきました。

 …ということは、更新が出来てないということで、とりあえず yum -y update をかけましたが、アップデートは無いようで、仕方が無いので kusanagi update cert をすると、エラーの嵐。

 いったいどうすれば?と悩みました。

まずnginxをチェック

# nginx -t -c /etc/nginx/nginx.conf

と入れてみたところ、エラー吐いていたので、とりあえずエラーの元を修正しました。

Let's Encryptの証明書を強制的に更新してみた。

KUSANAGIの場合、 certot-auto にパスが通ってないので、調べてみたら、 /usr/local/certbot/certbot-auto にありました。

下記のコマンドで強制的に証明書を更新させました。

# /usr/local/certbot/certbot-auto --force-renew
# /usr/local/certbot/certbot-auto --force-renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apachectl configtest.

AH00526: Syntax error on line 5 of /etc/httpd/conf.d/ssl.conf:
Cannot define multiple Listeners on the same IP:port


How would you like to authenticate and install certificates?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Apache Web Server plugin (apache) [Misconfigured]
2: Nginx Web Server plugin (nginx)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):  2
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: horornis.com
2: develop.horornis.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2
Renewing an existing certificate
Deploying Certificate to VirtualHost /etc/nginx/conf.d/develop.horornis.com_ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Traffic on port 80 already redirecting to ssl in /etc/nginx/conf.d/develop.horornis.com_http.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Your existing certificate has been successfully renewed, and the new certificate
has been installed.

The new certificate covers the following domains: https://develop.horornis.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=develop.horornis.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/develop.horornis.com-0001/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/develop.horornis.com-0001/privkey.pem
   Your cert will expire on 2019-11-22. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. 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

 とりあえず、これでサイトの表示が復活したので、しばらくこのまま試してみようと思います…。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6