OS X Mountain Lion Apache 被禁止

OS X Mountain Lion Apache 被禁止

我遵循这个指南:原生 Lamp 堆栈 macos x

我在 hello 中创建了 Sites/hello/ 文件夹和 htdocs 文件夹。当我 ping hello.dev -> 时,我尝试 localhost/~username/hello -> Forbidden 时看到 404 localhost/hello -> Forbidden

我不知道如何准备好网络服务器。

答案1

  • 取消#Include /private/etc/apache2/extra/httpd-vhosts.conf注释/etc/apache2/httpd.conf
  • 添加127.0.0.1 test.dev/etc/hosts
  • 另存为/etc/apache2/users/username.conf

    <Directory "/Users/username/Sites">
        Options Indexes MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    <VirtualHost *:80>
        ServerName test.dev
        DocumentRoot /Users/username/Sites/test
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot /Users/username/Sites
    </VirtualHost>
    
  • 跑步sudo apachectl restart

相关内容