Apache的虚拟主机和本地主机 [英] Apache VirtualHost and localhost

查看:159
本文介绍了Apache的虚拟主机和本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和XAMPP Mac OS X上工作
我想正常运行的客户端symfony的网站,我真的不知道(但)symfony的,我只是想安装并启动它。

I'm working with XAMPP on Mac OS X. I'm trying to run properly a symfony website for a client, i really don't know (yet) symfony, i just want to install and launch it.

我改etc / hosts文件是这样的:

I've changed my etc/hosts this way:

127.0.0.1 www.mysite.local       

和httpd.conf中是这样的:

and the httpd.conf this way:

<VirtualHost *:80>
  ServerName www.mysite.local
  DocumentRoot /Applications/MAMP/htdocs/mysite/web
  DirectoryIndex index.php
  <Directory /Applications/MAMP/htdocs/mysite/web>
    AllowOverride All
    Allow from All
  </Directory>
  Alias /sf /Applications/MAMP/htdocs/mysite/lib/vendor/symfony/data/web/sf
  <Directory "/Applications/MAMP/htdocs/mysite/lib/vendor/symfony/data/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

现在,该网站工作(耶!),但我不能再访问我没有其他地方的网站,因为本地主机
 呈现为 www.mysite.local
在那里我错了?

Now, the site is working (yay!), but i can't access anymore none of my other local sites because localhost is rendered as www.mysite.local. Where i'm wrong?

感谢您!

推荐答案

这是正常的,如果你看到它。既然是第一个虚拟主机条目,它会显示本地主机。

This is normal if you see it. Since it is the first virtual host entry it will show local host.

比方说,比如你不想该页面显示。所有你想要显示就是Apache它的工作页面,让你会作出mysite.local作为本地主机前的虚拟主机条目并将其指向它的工作原理页面。

Lets say for example you didn't want that page to show. All you want to show is apache it works page so you would make a vhost entry before mysite.local as local host and point it to the it works page.

但是,这是正常的。我有这个问题之前,所以不用担心!

But this is normal. I had this problem before so don't worry!

这篇关于Apache的虚拟主机和本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆