【问题标题】:os x MAMP apache virtual host laravel project misconfiguredos x MAMP apache 虚拟主机 laravel 项目配置错误
【发布时间】:2016-09-19 15:47:57
【问题描述】:

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

根据网上很多资源,我做了以下工作:

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

  2. 我在/Applications/MAMP/conf/apache/httpd.conf 中取消了Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.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>
    
  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>
    

毕竟,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.

【问题讨论】:

    标签: apache mamp osx-elcapitan virtual-hosts


    【解决方案1】:

    问题解决了! 因为apache已经更新到apache2.2, 在 Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 中, 将Require all granted 更改为Satisfy Any

    就是这样!

    我花了两天时间才弄明白~

    【讨论】:

      猜你喜欢
      • 2012-12-26
      • 2013-07-12
      • 2011-05-04
      • 2017-06-14
      • 2012-08-22
      • 2011-10-13
      • 1970-01-01
      • 2013-02-17
      相关资源
      最近更新 更多