好,
我知道如何做虚拟主机,但在Windows上看起来很难得到我想要的。
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:/wamp/www/domaindev_com/public" ServerName domaindev.com ServerAlias *.domaindev.com ErrorLog "logs/domaindev_com-error.log" CustomLog "logs/domaindev_com-access.log" common </VirtualHost>
和我的主机文件:
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 127.0.0.1 localhost 192.168.0.1 domaindev.com 192.168.0.1 www.domaindev.com C:\Documents and Settings\B>ping domaindev.com Pinging domaindev.com [192.168.0.1] with 32 bytes of data: Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 192.168.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms C:\Documents and Settings\B>ping www.domaindev.com Pinging www.domaindev.com [192.168.0.1] with 32 bytes of data: Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Reply from 192.168.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 192.168.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
所以它看起来像它的作品。 但是,当我尝试在我的浏览器中使用www.domaindev.com我得到一个时间或DNS故障…
有任何想法吗 ? ServerAlias选项是否错误?
编辑:只有domaindev.com正在工作
你有没有testing将ServerAlias指令改为绝对URL www.domaindev.com并尝试?
您的浏览器也可能caching了失败的DNS请求,并且没有再次尝试它 – 通常会导致所有浏览器会话被终止。
这些configuration文件在服务器上,对不对? 你试图加载它的浏览器是在你的个人计算机上,而不是服务器上? 因为,请参阅将192.168.0.1 www.domaindev.com放在主机文件中时,它只会使其在该机器上parsing,而不是其他任何内容。 尝试把它放在你的工作站的主机文件。
你能通过domaindev.com访问该网站吗? 通过IP地址? 如果你不能这不是一个解决问题,但一个Apache的configuration/启动问题,因为服务器没有运行。
您的网页浏览器中是否有任何活动的代理configuration? 尝试停用代理。 有时在命令提示符下执行命令“ipconfig / flushdns”会有所帮助。
您是否已经尝试使用“domaindev.com”连接到您的网站? 如果这个工作比你必须改变你的ServerAlias指令到一个fqdn。 http://httpd.apache.org/docs/2.0/mod/core.html#serveralias