【问题标题】:Can't get MAMP working with Virtual hosts无法让 MAMP 与虚拟主机一起使用
【发布时间】:2015-01-12 05:50:43
【问题描述】:

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

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

底线似乎只读取了第一个虚拟主机条目,这就是列出的每个主机所使用的内容。我在某处错过了一些设置吗??

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

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

  • httpd.conf 文件: 包括 /Applications/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>

【问题讨论】:

    标签: php web mamp virtual-hosts


    【解决方案1】:

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

    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>
    

    主机文件:

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

    现在看看我能否让 SSL 工作。

    如果其中任何一个不正确,请告诉我...但是到目前为止,此配置是我可以使用端口 80 使虚拟主机正常工作的唯一方法...如果我在与 443 混合时遇到问题,我会更新的

    【讨论】:

      猜你喜欢
      • 2012-12-28
      • 2015-08-03
      • 2015-05-07
      • 1970-01-01
      • 2020-02-15
      • 1970-01-01
      • 2013-06-20
      • 2018-04-16
      • 1970-01-01
      相关资源
      最近更新 更多