配置apache mod_alias给出内部服务器错误

时间:2014-11-28 09:26:30

标签: apache .htaccess mod-alias

我的虚拟主机配置如下

<VirtualHost 127.0.0.1:80>
    ServerAdmin                     admins@example.com
    DocumentRoot                    /home/mydir

    ServerName                      mydir.domain.com

    ErrorLog                        /home/mydir/logs/apache-local-error_log
    CustomLog                       /home/mydir/logs/apache-local-access_log common
    RewriteEngine                   on
    RewriteLog                      /home/mydir/logs/rewrite.log
    RewriteLogLevel                 3

    Alias /proj /home/mydir/proj/public_html

    <Directory /home/mydir>
        Options +Indexes
        AllowOverride       ALL
    </Directory>
</VirtualHost>

我在/ home / mydir / proj中安装了laravel,当我尝试访问http://mydir.domain.com/proj时,我收到“内部服务器错误”,并在日志中得到以下信息:

rewrite.log:

IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (2) init rewrite engine with requested uri /proj/public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (1) pass through /proj/public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] add path info postfix: /home/mydri/proj/public_html/public_html -> /home/mydri/proj/public_html/public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] strip per-dir prefix: /home/mydri/proj/public_html/public_html/index.php -> public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] applying pattern '^(.*)/$' to uri 'public_html/index.php'
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] add path info postfix: /home/mydri/proj/public_html/public_html -> /home/mydri/proj/public_html/public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] strip per-dir prefix: /home/mydri/proj/public_html/public_html/index.php -> public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] applying pattern '^.*$' to uri 'public_html/index.php'
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (2) [perdir /home/mydri/proj/public_html/] rewrite 'public_html/index.php' -> 'index.php'
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (3) [perdir /home/mydri/proj/public_html/] add per-dir prefix: index.php -> /home/mydri/proj/public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (2) [perdir /home/mydri/proj/public_html/] strip document_root prefix: /home/mydri/proj/public_html/index.php -> /proj/public_html/index.php
IP Address - - [28/Nov/2014:13:16:58 +0400] [mydri.domain.com/sid#7f4fc4e07098][rid#7f4fc574f508/initial/redir#10] (1) [perdir /home/mydri/proj/public_html/] internal redirect with /proj/public_html/index.php [INTERNAL REDIRECT]

Apache的本地error_log中:

[Fri Nov 28 13:16:58 2014] [error] [client IP Address] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

在/ home / mydir / proj / public_html我有标准的.htaccess for laravel:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*$ index.php [L]

    RewriteCond %{HTTP:Authorization} ^(.+)$
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

任何建议我做错了将不胜感激。

1 个答案:

答案 0 :(得分:0)

更新配置文件。

    ServerAdmin admins@example.com     DocumentRoot / home / mydir

ServerName                      mydir.domain.com

ErrorLog                        /home/mydir/logs/apache-local-error_log
CustomLog                       /home/mydir/logs/apache-local-access_log common
RewriteEngine                   on
RewriteLog                      /home/mydir/logs/rewrite.log
RewriteLogLevel                 3

Alias /proj /home/mydir/proj/public_html

<Directory /home/mydir>
    Options +Indexes
    AllowOverride all
    Require all granted
</Directory>