[英]How to access virtual host from the internet?
我想通过互联网上的虚拟主机访问我的网站。 目前,我使用服务器的公共IP地址访问我的网站。 这是我正在使用的(请参见下文)。
DNS_PROBE_FINISHED_NXDOMAIN错误
无法找到mysite的服务器IP地址。
ERR_SSL_PROTOCOL_ERROR
122.4.195.12发送了无效回复。
http://122.4.195.12:7777/site/index.php - > https://122.4.195.12:7777/site/index.php
这是我的虚拟主机配置:
<VirtualHost *:7777>
DocumentRoot "C:\xampp\htdocs"
ServerName mysite
<Directory "C:\xampp\htdocs">
Require all granted
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName mysite
SSLEngine on
SSLCertificateFile "crt/scratchitsite/server.crt"
SSLCertificateKeyFile "crt/mysite/server.key"
<Directory "C:\xampp\htdocs">
Require all granted
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
这是我的服务器的主机文件:
127.0.0.1 mysite
对于问题1
更简单的方法仍然是注册域名,将其指向您的IP地址,并为其设置VirtualHost ServerName
VirtualHost实际上从服务器站点检测到Host
HTTP Header,因此关键是:
如何使客户端浏览器发送
Host
头与您在服务器上定义的相同
例如,通过使用CURL,您可以强制它使用用户定义的Host
头,如下所示: curl -H 'Host: mysite' 122.4.195.12:7777/site/index.php
如果您使用的是Chrome,则可以尝试使用浏览器扩展程序,如下所示
对于问题2
您已在Apache配置中的端口443而不是7777上启用HTTPS
这意味着您应该访问您的HTTPS服务,如https://122.4.195.12:443/site/index.php
而不是https://122.4.195.12:7777/site/index.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.