SSL在XAMPP和自定义域上不起作用

时间:2018-08-01 14:57:58

标签: apache ssl

我试图模仿我的本地主机环境,使其尽可能接近生产服务器上的本地主机环境。为此,我想使用https和虚拟域mydomain.test,该域配置为指向/etc/hosts中的127.0.0.1

这是我的配置:

/ etc / hosts:

127.0.0.1 mydomain.test
127.0.0.1 subdomain.mydomain.test

/Applications/XAMPP/xamppfiles/etc/httpd.conf

#virtual host for port 80 works as expected
...

<VirtualHost *:443>
    ServerName mydomain.test
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/public_html"

    <Directory "/Applications/XAMPP/xamppfiles/htdocs/public_html">
         Require all granted
         Options +Includes
         AllowOverride None
         Require all granted
    </Directory>
    #DirectoryIndex index.html

    SSLEngine on
    SSLCertificateFile /Applications/XAMPP/xamppfiles/etc/ssl/mydomain.crt
    SSLCertificateKeyFile /Applications/XAMPP/xamppfiles/etc/ssl/mydomain.key
    AddType application/x-httpd-php .htm .html
    ErrorLog /Applications/XAMPP/xamppfiles/logs/localhost-mydomain-error_log
    CustomLog /Applications/XAMPP/xamppfiles/logs/localhost-mydomain-access_log combined

</VirtualHost>

/ Applications / XAMPP / xamppfiles / etc / ssl /包含使用以下命令自行创建的证书:

openssl req -x509 -out mydomain.crt -keyout mydomain.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=mydomain.test' -extensions EXT -config <( \
   printf "[dn]\nCN=mydomain.test\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:mydomain.test\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

命令sudo /Applications/XAMPP/xamppfiles/xampp enablessl返回启用的SSL。

我不确定接下来要尝试什么。你会建议我做什么?

0 个答案:

没有答案