LoginSignup
2
2

More than 5 years have passed since last update.

xampp + ssl + vhosts + windows オレオレ証明書のインストール

Last updated at Posted at 2016-07-29

【備忘録】
*************手順*************
①オレオレ証明書を作成する
②apacheにインストールする
③vhostsの設定をする
A:httpd-vhosts.conf
B:httpd-ssl.conf
C:hosts

*************詳細*************
①オレオレ証明書を作成する
参考:http://d.hatena.ne.jp/ozuma/20130511/1368284304

秘密鍵(Private Key)作成
$ openssl genrsa 2048 > oreore_server.key
    内容確認:$ openssl rsa -text < oreore_server.key

証明書署名要求(CSR)作成
$ openssl req -new -key oreore_server.key > oreore_server.csr
    ※以下は初期値のままでも構わない
    Country Name        :国(JP)
    State or Province Name  :都道府県
    Locality Name       :市区町村
    Organization Name   :企業名
    Organization Unit Name  :所属
    Common Name     :取得したいドメイン名※1(共通)
    Email Address       :管理者メールアドレス
    A challenge password    :証明書を破棄する際に必要になるパスワードの設定
    An optional company name:別の組織名
    内容確認:$ openssl req -text < oreore_server.csr

サーバー証明書作成
$ openssl x509 -req -days 3650 -signkey oreore_server.key < oreore_server.csr >oreore_server.crt
    -days 3650  有効期限3650日
    内容確認:$ openssl x509 -text < oreore_server.crt

②apacheにインストール
「xampp/apache/conf/ssl.crt」に「oreore_server.crt」をコピー
「xampp/apache/conf/ssl.key」に「oreore_server.key」をコピー

③vhostsの設定
A:httpd-vhosts.confの編集
以下の行を追加する
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

ServerName test.com.localhost ←ドメイン名※1(共通)
DocumentRoot C:\xampp\htdocs\test.com\html ←ドキュメントルートを指定※2(共通)

←ドキュメントルート※2(共通)
order deny,allow
allow from ALL
Require all granted

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

B:httpd-ssl.confの編集
    以下のように編集する
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    #<VirtualHost _default_:443>
    NameVirtualHost *:443
    <VirtualHost *:443>

    ServerName test.com.localhost   ←ドメイン名※1(共通)
    #ServerName www.example.com:443

    DocumentRoot "C:\xampp\htdocs\test.com\html"    ←ドキュメントルート※2(共通)
    #DocumentRoot "C:/xampp/htdocs"

    SSLCertificateFile "conf/ssl.crt/oreore_server.crt"
    #SSLCertificateFile "conf/ssl.crt/server.crt"

    SSLCertificateKeyFile "conf/ssl.key/oreore_server.key"
    #SSLCertificateKeyFile "conf/ssl.key/server.key"
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

C:hostsファイルの編集
    C:\Windows\System32\drivers\etc\hostsをメモ帳などで開いて追記
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    127.0.0.1   test.com.localhost
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

xampp-control.exeでapacheを再起動
証明書のインストールが確認されればOK(信頼はされていない)
2
2
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
2
2