バーチャルホスト

 /home/anpachi/html/

************************************************************ 

バーチャルホスト用ドキュメントルートディレクトリ作成
/home/anpachi/html/をバーチャルホストドキュメントルートに設定

[root@falcon21 ~]# vi /etc/httpd/conf/httpd.conf

#ServerName falcon21.space:80

NameVirtualHost *:80

----  
<VirtualHost *:80>
        ServerName anpachi.moe.hm
        DocumentRoot /home/anpachi/html
        ErrorLog /home/anpachi/logs/anpachi_error_log
        CustomLog /home/anpachi/logs/anpachi_access_log combined env=!no_log
</VirtualHost>

<Directory "/home/anpachi/html">
    Options Includes ExecCGI FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory "/home/anpachi/cgi-bin">
    Options None
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

------------ 
未定義ホスト用バーチャルホスト設定ファイル作成
[root@falcon21 ~]# vi /etc/httpd/conf.d/virtualhost-00.conf
<VirtualHost _default_:80>
    ServerName any
    <Location />
        Require all denied
    </Location>
</VirtualHost>
~                      
------------------  
メインホスト用バーチャルホスト設定ファイル作成
[root@falcon21 ~]# vi /etc/httpd/conf.d/virtualhost-falcon21.space.conf
<VirtualHost _default_:80>
    ServerName falcon21.space
    DocumentRoot /var/www/html
</VirtualHost>

---------------------  
追加ホスト用バーチャルホスト設定ファイル作成
[root@falcon21 ~]# vi /etc/httpd/conf.d/virtualhost-anpachi.moe.hm.conf
<VirtualHost *:80>
    ServerName anpachi.moe.hm
    DocumentRoot /home/anpachi/html
    ErrorLog logs/anpachi.moe.hm-error_log
    CustomLog logs/anpachi.moe.hm-access_log combined env=!no_log
</VirtualHost>

-------------------  

[root@falcon21 ~]# /etc/rc.d/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]
***********************************  

バーチャルホストのためのサーバー証明書取得 
Apache+mod_SSL+Certbot

[root@falcon21 ~]# yum -y install epel-release

[root@falcon21 ~]# cd /usr/local/
[root@falcon21 local]# git clone https://github.com/certbot/certbot
Initialized empty Git repository in /usr/local/certbot/.git/
remote: Counting objects: 46084, done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 46084 (delta 42), reused 42 (delta 17), pack-reused 45995
Receiving objects: 100% (46084/46084), 13.85 MiB | 320 KiB/s, done.
Resolving deltas: 100% (32921/32921), done.

[root@falcon21 local]# cd

Certbotクライアントインストール
[root@falcon21 ~]# /usr/local/certbot/certbot-auto -n
Creating virtual environment...
Installing Python packages...
Installation succeeded.
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Missing command line flags. For non-interactive execution, you will need to specify a plugin on the command line.  Run with '--help plugins' to see a list of options, and see https://eff.org/letsencrypt-plugins for more detail on what the plugins do and how to use them.

----------  

バーチャルホストのためのサーバー証明書取得
[root@falcon21 ~]# /usr/local/certbot/certbot-auto certonly --webroot -w /home/anpachi/html -m webmaster@anpachi.moe.hm -d anpachi.moe.hm –agree-tos
Upgrading certbot-auto 0.14.1 to 0.14.2...
Replacing certbot-auto...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning
usage: 
  certbot-auto [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
cert. 
certbot: error: unrecognized arguments: –agree-tos


  Python 2.6 では、対応できない。?

agree-tos を外して試行

[root@falcon21 ~]# /usr/local/certbot/certbot-auto certonly --webroot -w /home/anpachi/html -m webmaster@anpachi.moe.hm -d anpachi.moe.hm
[root@falcon21 ~]# /usr/local/certbot/certbot-auto certonly --webroot -w /home/anpachi/html -m webmaster@anpachi.moe.hm -d anpachi.moe.hm
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for anpachi.moe.hm
Using the webroot path /home/anpachi/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/anpachi.moe.hm/fullchain.pem. Your cert will
   expire on 2017-08-24. 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"
重要なメモ:
- おめでとう! 証明書とチェーンが保存されました
 /etc/letsencrypt/live/anpachi.moe.hm/fullchain.pem。
 あなたの証明書は, 有効期限は2017-08-24です。 
これの新しいバージョンまたは変更されたバージョンを入手するには

証明書を発行するには、単にcertbot-autoを再度実行します。 に
非インタラクティブに*すべての証明書を更新して実行する
 "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
************************************************************************** 
投票数:2 平均点:10.00

 
Back to Top