首页 > 解决方案 > 通过ip地址访问服务器时如何实现SSL?

问题描述

我正在通过服务器的 IP 地址(例如http://13.70.72.102:7777/test/index.php )访问我手机中的服务器,IP 地址(13.70.72.102)是我服务器的公共地址。当我将 http 更改为 https 时,我收到“此站点无法提供安全连接 (ERR_SSL_PROTOCOL_ERROR)”。我可以将 SSL 添加到我的虚拟主机,但要访问我的虚拟主机,我需要编辑每个设备中的所有主机文件,这就是我通过我的 IP 地址访问我的服务器的原因。如何为此添加 SSL?

这是我的主机文件:

127.0.0.1       server.test
13.70.72.102    server.test

这是我的 httpd-vhost.conf

<VirtualHost *:7777>
DocumentRoot "C:\xampp\htdocs"
  ServerName server.test
  <Directory "C:\xampp\htdocs">
    Require all granted
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
<VirtualHost *:443>
     DocumentRoot "C:/xampp/htdocs"
     ServerName server.test
     SSLEngine on
     SSLCertificateFile "crt/server.test/server.crt"
     SSLCertificateKeyFile "crt/server.test/server.key"
     <Directory "C:\xampp\htdocs">
        Require all granted
        AllowOverride All
        Order allow,deny
        Allow from all
      </Directory>
 </VirtualHost>

标签: apachehttpsslhttpsxampp

解决方案


推荐阅读