apache - 通过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>
解决方案
推荐阅读
- c++ - 在 OMNET ++ define_module 中分配抽象类类型的对象
- javascript - 如何在Vue中为嵌套递归树结构放置备用背景
- amazon-web-services - 将最小服务部署到 ECS Fargate,无需通过公共 Internet 访问负载均衡器
- python - 有没有办法在 Python 中操纵编号段落以删除某些不按顺序排列的段落?
- mysql - 为 GROUP BY 取随机行
- html - 下拉菜单不显示
- c++ - 任意长数除法
- php - storage_path('/app/public/') 的确切位置在哪里
- wildfly - 如何在两个 Wildfly 服务器组之间建立 JMS 桥接或转移?
- testing - 在我们的应用程序中使用 testcafe 键入文本对于特定页面很慢,该页面中的下拉操作执行得很快