2

I have following configuration for my virtual host

<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>

i have laravel installation in /home/mydir/proj and when I try to access http://mydir.domain.com/proj I get "Internal Server Error" and in logs I get following:

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-local-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.

In /home/mydir/proj/public_html I have standard .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>

Any suggestions what I am doing wrong would be appreciated.

Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
Tornike
  • 1,245
  • 12
  • 35
  • index.php does not exist in the location it is searching for it? – Sumurai8 Nov 28 '14 at 09:30
  • There is index.php in /home/mydir/proj/public_html @Sumurai8 – Tornike Nov 28 '14 at 09:32
  • I assume the Alias you have is the culprit. I don't have enough experience with those to be sure though. Try commenting that out, restarting Apache (required step!) and trying again. – Sumurai8 Nov 28 '14 at 09:33
  • @Sumurai8 yes alias is the problem and I need to fix it not remove. I have removed and it works if I go to http://mydir.domain.com/proj/public_html but I don't want to write public_html in url and I don't want files above public_html to be accessible though http – Tornike Nov 28 '14 at 09:38
  • Why not change the document_root then? If you don't want access to files below that level, you should move the document root to the /proj/public_html directory instead. – Sumurai8 Nov 28 '14 at 09:43
  • @Sumurai8 I have lots of projects like that and I don't want to create individual virtual hosts for each of them – Tornike Nov 28 '14 at 09:44

1 Answers1

0

Update the configuration file.

<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
        Require all granted
    </Directory>
</VirtualHost>
Ali Padida
  • 1,763
  • 1
  • 16
  • 34
  • I have apache 2.2 and the Reuire all granted gives me following error: "configuration error: couldn't perform authentication. AuthType not set!" I have searched for the solution but most of time i get that i need to remove it or use "allow from all" instead. tried it but no luck. – Tornike Dec 01 '14 at 08:20