我在本地主机中使用域名时遇到问题
我正在使用windows 8.1 64 bit
和drive F
中的xampp
我已经在F:\xampp\apache\conf
中编辑httpd.conf
以加载vhost
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
已经在F:\xampp\apache\conf\extra
中编辑了太多httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/itklan/public/"
ServerName mydomain.dev
ServerAlias mydomain.dev
<Directory "F:/xampp/htdocs/itklan/public/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我在C:\Windows\System32\drivers\etc
中添加到host
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 mydomain.com
已经重新启动apache
...我甚至重新启动我的windows
但我仍然得到这样的东西在谷歌浏览器
This webpage is not available
ERR_CONNECTION_REFUSED
我错过了什么?
- ps:我仍然可以正常访问
http://localhost:8080/itklan/public/
*
更新
当我尝试ping mydomain.dev
时,它成功地从我的localhost ip接收到所有数据,如下所示
我测试运行127.0.0.1它显示
This webpage is not available
ERR_CONNECTION_REFUSED
当然,因为我将Apache端口更改为8080
,将MySQL端口更改为4433
所以应该是127.0.0.1:8080来打开xampp主页
基于this页面-〉* 感谢abdula*
我尝试编辑“httpd-vhosts.conf”并使其侦听端口8080
但是当我添加脚本Listen 8080
时,我的apache将不会再次运行
我尝试将该脚本更改为Listen 80
,它使我的apache可以再次运行。我注意到,如果apache打开的端口现在变为3个(80, 8080, 4433)
,那么我想我不需要再次添加Listen 8080
,因为我的apache已经侦听该端口
所以我就把剩下的改成这样
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "F:/xampp/htdocs/itklan/public/"
ServerName mydomain.dev
</VirtualHost>
以及hosts file
中的值
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 mydomain.dev
但还是一样
2条答案
按热度按时间l2osamch1#
Don't use
.com
domain. use.dev
or something which not availableand try this host
VirtualHost Examples
EDIT 01
qvsjd97n2#
这可能听起来很傻或不太可能,但你似乎没有提到检查你的防火墙设置。
虽然您在概念上是连接到自己,但端口80和443在默认情况下可能有不同的限制,您可能希望尝试允许TCP或UDP的入站端口,以满足您的需要。