LoginSignup
0
0

More than 3 years have passed since last update.

XAMPPでローカルにある複数のサイトのSSLを有効にする

Posted at

Introduction

今更ではありますが、XAMPPでローカル環境を構築していてSSL対応する必要があったのでメモ程度に残します。

環境

  • Windows10 64bit
  • すでに複数サイトがXAMPPに設定されている(v-hostsの設定が終わっている)

初回のみ対応

1. php.iniの設定を変更する

C:\xampp\php\php.ini の以下記述を変更する。

;extension=php_openssl.dll

↓↓↓

extension=php_openssl.dll

設定方法 (サイトを追加する度に行う)

1. httpd-ssl.confファイルに追記をする

https://の形式で閲覧できるように以下のファイルを末尾に加える

C:\xampp\apache\conf\extra\httpd-ssl.conf

<VirtualHost 127.0.0.2:443>
    DocumentRoot "C:\Users\user-name\htdocs\xxx"
    ServerName localhost:443

    SSLEngine on
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>

2. httpd-vhosts.confの設定を書き換える

以下のファイルの設定を書き換える

C:\xampp\apache\conf\extra\httpd-vhosts.conf

Listen 12000
<VirtualHost *:12000>
    DocumentRoot "C:\Users\user-name\htdocs\xxx"

    <Directory "C:\Users\user-name\htdocs\xxx">
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AddType text/html .shtml
    AddHandler server-parsed .inc
    AddHandler server-parsed .shtml
    AddHandler cgi-script .cgi .pl
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

↓↓↓

<VirtualHost 127.0.0.2> 
    DocumentRoot "C:\Users\user-name\htdocs\xxx"
    ServerName site.local

    <Directory "C:\Users\user-name\htdocs\xxx">
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AddType text/html .shtml
    AddHandler server-parsed .inc
    AddHandler server-parsed .shtml
    AddHandler cgi-script .cgi .pl
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

3. Apacheを再起動する

何もエラーをはかなければ成功
https://127.0.0.2/ でアクセスしてみる

0
0
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
0
0