オレオレ証明書作成
cd /private/etc/apache2
sudo sh -c "openssl genrsa 2048 > server.key"
sudo sh -c "openssl req -new -key server.key > server.csr"
sudo sh -c "openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt"
common name のみ設定する
httpd-ssl.conf有効化
/private/etc/apache2/httpd.conf
# Secure (SSL/TLS) connections
Include /private/etc/apache2/extra/httpd-ssl.conf
SSL の設定
以下はデフォルト変更してるのでちゃんとやるなら分離してください。
/private/etc/apache2/extra/httpd-ssl.conf
77行目あたりを修正
DocumentRoot "/LocalDir/public"
ServerName hogehoge.jp:443
また最終行あたりにディレクトリの設定も追加する
/private/etc/apache2/extra/httpd-ssl.conf
<Directory "/LocalDir/public">
AllowOverride AuthConfig FileInfo Indexes Limit Options=All,MultiViews
Options -MultiViews
order deny,allow
deny from All
allow from localhost 127.0.0.1
</Directory>
apache再起動
sudo /usr/sbin/apachectl restart