os x MAMP apache 虚拟主机 Laravel 项目配置错误

Mat*_*Pan 2 apache mamp virtual-hosts osx-elcapitan

MAMP 安装在 MacBook 中。我使用 MAMP apache。

基于许多在线资源,我做了以下工作:

  1. 我添加127.0.0.1 my-site.local到文件/etc/host.

  2. Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf/Applications/MAMP/conf/apache/httpd.conf.

  3. 在 中/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf,我添加了

    <VirtualHost *:80>
            DocumentRoot "/Users/myname/laravel/mysite/public"
            ServerName my-site.local
            ServerAlias my-site.local
            <Directory "/Users/myname/laravel/mysite/public">
                    DirectoryIndex index.php
                    Options +Indexes +FollowSymLinks +MultiViews
                    AllowOverride All
                    Require all granted
            </Directory>
    </VirtualHost>
    
    Run Code Online (Sandbox Code Playgroud)
  4. /Users/myname/laravel/mysite/.htaccess文件中:

    <IfModule mod_rewrite.c>
    
            Options +Indexes +FollowSymLinks +MultiViews
            RewriteEngine On
            #RewriteBase /
    
            # Redirect Trailing Slashes If Not A Folder...
            #RewriteCond %{REQUEST_FILENAME} !-d
            #RewriteRule ^(.*)/$ /$1 [L,R=301]
            RewriteCond %{HTTP:Authorization} ^(.*)
            RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
    
            # Handle Front Controller...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
    
            Require all granted
    
    </IfModule>
    
    Run Code Online (Sandbox Code Playgroud)

毕竟,localhostlocalhost/MAMPlocalhost/phpMyAdmin,所有工作,除了my-site.local。表明500 Internal server error. The server encountered an internal error or misconfiguration and was unable to complete your request.

Mat*_*Pan 5

问题解决了!因为Apache已经更新到APACHE2.2,在应用程序/ MAMP / conf目录/阿帕奇/额外/的httpd-vhosts.conf,变化Require all grantedSatisfy Any

这就对了!

花了两天时间才弄明白~