【发布时间】:2022-01-03 03:10:01
【问题描述】:
我的问题可能很愚蠢,但老实说,我搜索了很多并获得了成功但并不完整。
我在 Windows 8 中使用 xampp。
我的主机文件如下所示。
127.0.0.1 localhost
127.0.0.1 www.mysite.com
我的 httpd-vhosts.config 如下所示。
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName www.mysite.com
ServerAlias mysite.com
DocumentRoot "C:/xampp/htdocs/mysite"
</VirtualHost>
这非常适合 http。 但我启用了 ssl。
当我输入http://localhost 或https://localhost 时,两者都可以正常工作。
当我输入http://mysite.com 时,它可以工作,
当我输入 https://mysite.com 时,它被重定向为 https://mysite.com/xampp/ 并显示 xampp 的默认欢迎页面。
我尝试了以下事情。
1) 我没有使用 127.0.0.1,而是尝试在 httpd-vhosts.conf 中使用 *:80 但结果是一样的。
2) 我没有使用 127.0.0.1,而是尝试在 httpd-vhosts.conf 中使用 *:443 但是在重新启动时 apache 无法再次启动。
请告诉我如何通过域名而不是使用 https 或 http 的 localhost 访问我的网站。
【问题讨论】:
-
尝试在 php.ini 中取消注释 extension=php_openssl.dll 并重启 apache
-
你提到的那一行已经被注释掉了,这就是为什么我可以通过https://localhost/othersite/在https中使用我的其他站点/我应该评论重启,然后再次取消注释并重新启动?跨度>
-
可能也需要 apache 支持,取消注释 xampp/apache/conf/httpd.conf 中的#LoadModule ssl_module modules/mod_ssl.so
-
@shapeshifter 你提到的文件已经被取消注释了。
-
@JeetChaudhari 你有没有在 Windows 防火墙中为端口添加异常
标签: php apache xampp localhost domain-name