我在mac os狮子上使用Xampp(Apace 2.2.20)进行开发。 我有一些CMS项目,我想访问他们去cms1.localhost,cms2.localhost,cms3.localhost等
目前,在下面的设置中,所有到服务器的请求都由我在configuration中首先放置的任何虚拟主机解决,即当前(/ Applications / XAMPP / migration / trunk)。
任何人都可以请指点我在正确的方向。 我无法想象在debugging等方面还有什么可以做的,所以帮助也是有用的。 非常感谢。
<VirtualHost *:80> ServerName localhost DocumentRoot "/Applications/XAMPP/migration/trunk" </Virtualhost> <VirtualHost *:80> ServerName rix.localhost DocumentRoot "/Applications/XAMPP/projects/giving" </Virtualhost>
在/ etc / hosts中我有:
127.0.0.1 localhost 127.0.0.1 rix.localhost
假设你已经尝试交换了两个VirtualHost块,并且你在localhost和rix.localhost上得到相应的站点加载,你可能会缺lessNameVirtualHost *:80指令。
看看你的Apacheconfiguration。 如果它不在任何地方,请将其添加到主configuration区域的某处(即不在VirtualHost块中)。
我喜欢为每个VirtualHost设置日志logging,所以在每个VirtualHost节中使用ErrorLog和CustomLog Apache指令。 在主configuration文件中也可能有对应的行(VirtualHost部分之外),这对于我们来说可能是有用的。
启动apache时,重叠的VirtualHosts等错误会被logging下来。 我不能告诉你XAMMP在启动的时候会输出这些错误,但是我认为它会把它们logging在某个地方。 XAMMP文档将是一个很好的开始。