2014-11-14 73 views
0

我很难使用虚拟主机获取多个使用MAMP的站点。以下是我在我的MBA课程中设置的内容。如果我打开我的网络浏览器并转到“http:local.login.dev”或“http://dev.login.localhost”(重新配置后),我会得到保存在/ Users/aaron/localhost中的索引页。我的虚拟主机部分中列出的第一项不是保存在我想要访问的虚拟主机中的索引页。我设置的其他网站也给了我相同的结果..“http:next.site.localhost”=在/ Users/aaron/localhost中显示索引页面。无法使用MAMP与虚拟主机协同工作

有没有人有任何想法?我的最终目标是配置MAMP虚拟主机以使用SSL进行工作和测试。

底线是,好像只有第一个虚拟主机条目被读取,这是什么用于列出的所有主机。我错过了一些设置?

环境: - MBA与OS X,优胜美地

  • MAMP 3.0.7.3使用端口80和3306的http和mysql的分别

  • httpd.conf文件: 包含/应用/MAMP/conf/apache/extra/httpd-vhosts.conf

    127.0.0.1本地主机
    127.0.0.1 local.login.dev

    <VirtualHost *> 
        DocumentRoot "/Users/aaron/localhost" 
        ServerName localhost 
    </VirtualHost> 
    
    <VirtualHost *:80> — I tried both with and without :80 
        DocumentRoot "/Users/aaron/localhost/training/login/public" 
        ServerName local.login.dev 
    </VirtualHost> 
    

也试过我的配置和主机的httpd-vhosts.conf这样 - 从另一篇文章:

127.0.0.1本地主机
127.0.0.1 dev.login.localhost

<VirtualHost *> 
    DocumentRoot "/Users/aaron/localhost" 
    ServerName localhost 
</VirtualHost> 

<VirtualHost *:80> 
    DocumentRoot "/Users/aaron/localhost/training/login/public" 
    ServerName dev.login.localhost 
    ServerAlias dev.login.localhost 
    <Directory "/Users/aaron/localhost/training/login/public"> 
     Allow from All                 
     AllowOverride all                
     Options -Indexes +FollowSymlinks             
    </Directory> 
</VirtualHost> 

回答

1

只是玩得更多我在我的httpd-vhosts.conf文件中注释掉了第一个“Localhost”,看起来像我现在可以正确导航到我的本地站点。下面是我目前拥有的ConfigEd ..

的httpd-vhosts.conf:

 # <VirtualHost *> 
    #  DocumentRoot "/Users/aaron/localhost/" 
    #  ServerName localhost 
    # </VirtualHost> 

    <VirtualHost *:80> 
      DocumentRoot "/Users/aaron/localhost/training/login/public" 
      ServerName dev.login.localhost 
      ServerAlias dev.login.localhost 
    </VirtualHost> 

    <VirtualHost *:80> 
      DocumentRoot "/Users/aaron/localhost/site1" 
      ServerName dev.site1.localhost 
      ServerAlias dev.site1.localhost 
    </VirtualHost> 

    <VirtualHost *:80> 
      DocumentRoot "/Users/aaron/localhost/site2" 
      ServerName dev.site2.localhost 
      ServerAlias dev.site2.localhost 
    </VirtualHost> 

Hosts文件:

 127.0.0.1 localhost 
    ######Locahost Dev Sites 
    127.0.0.1 dev.login.localhost dev.site1.localhost dev.site2.localhost 

我们看到,如果我能得到SSL工作。

如果有任何的这是不正确,请让我知道......但这个配置是我能得到的虚拟主机工作,截至目前,使用端口80的唯一途径...如果我有443混合问题我会更新