Xampp for Linuxで試験的に公開した時、少し不安だったLetsencryptの申請を試みたところ難なくワイルドカード(*.)で取得できてサイトもSSL化できた。Xamppでは、eff.org経由の取得だったのでLetsencryptから送られてきた証明書を手作業で登録、又Apache側から幾つかのモジュールを有効化した。Ubuntuのサーバパッケージに替えるためXamppとeff.orgを削除した後にあらゆるところでエラーが発生、時間をかけてサイト巡りをしたところ同じようなトラブルを解決した掲示板の記事を見つけ、その回答の記事を参考にして一度に解決させるることができた。その後HTTPで公開、その段階でapache用のCerbot-autoをインストールして最初に取得したワイルドカード(*.)を復活させてSSL化した。
# Xamppの削除後に発生したエラーの解決方法
1 2 3 4 5 6 7 8 9 10 |
# Xamppで修正した設定を無効化 /etc/apache2/site-available/に移動 a2dissite (設定ファイル名)で無効にする。 *default.conf,default-ssl.conf -->>Xamppで設定 # apach2用の.bk(mvコマンドで)戻してから a2ensite (設定ファイル名)で有効にする。 *default.conf,default-ssl.conf -->>apache2 # 同様に,有効化したsslのモジュールを無効化 a2dismod (モジュール名) *ssl, rewriteを無効にする。 a2enmod (モジュール名) *有効化コマンド |
# 削除したXampp関係プロセスがapacheのポートを使っている。
プロセスチックで発見した幾つかの「ナニコレ」と思うプロセスが。。。
1 2 3 4 |
ps aux | grep httpd | grep Ss # 親プロセスから ps aux | grep httpd | grep -v Ss | grep -v grep # 子プロセスを確認し、それらを削除して再度確認 |
# キャッシュの破棄
1 2 |
free -h でチェック sysctl -w vm.drop_caches=3 支障の無いキャッシュを削除 |
# Letsencryptの追加登録で以前の登録を復活
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
chmod 700 /usr/bin/certbot-auto certbot-auto ------------------------------------------------------------------------------ Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Which names would you like to activate HTTPS for? ------------------------------------------------------------------------------- 1: www.osshinet.com ------------------------------------------------------------------------------- Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): -->ここで多分「osshinet.com」? Obtaining a new certificate Performing the following challenges: http-01 challenge for www.osshinet.com Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/010-wordpress-le-ssl.conf Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/010-wordpress-le-ssl.conf Enabling available site: /etc/apache2/sites-available/010-wordpress-le-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 Redirecting vhost in /etc/apache2/sites-enabled/010-wordpress.conf to ssl vhost in /etc/apache2/sites-available/010-wordpress-le-ssl.conf ------------------------------------------------------------------------------- Congratulations! You have successfully enabled https://www.osshinet.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=www.osshinet.com ------------------------------------------------------------------------------- IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/www.osshinet.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/www.osshinet.com/privkey.pem Your cert will expire on 2018-08-24. 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 ------------------------------------------------------------------------------ |
*www.osshinet.comディレクトリーができたが、ワイルドカード用「osshinet.com」でサイトはSSL化してメール&FTPサーバにも使用。尚、eff.orgのディレクトリーも/opt/の中に再表示されたが。。。renewalの時に確認かな?
# 登録の確認と修正
1 2 3 4 5 |
/etc/apache2/sites-available/wordpress-le-ssl.conf SSLCertificateFile /etc/letsencrypt/live/osshinet.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/osshinet.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf *WWWのディレクトリーを変更! |
# Letsencryptの自動renewalを設定
1 2 |
crontab -e 30 2 * * 1 /usr/bin/certbot renew >> /var/log/le-renew.log |
WindowsからLinuxのUbuntu(X)に移行中は気が滅入っていたが、ここまで復活できたので良しだね。