Subdomain internal server error

Discussion in 'General' started by frprim, May 14, 2014.

  1. frprim

    frprim New Member

    Hi all,
    I have a site that is set up in suck way that root directory is not set to:
    /var/www/clients/client1/web1/web but
    /var/www/clients/client1/web1/web/subfolder/
    now I had to do this because the app was set up in such way and thats ok because I changed the DocRoot using Apache Directive in ISPconfig.
    The problem started to occur when I created a subdomain for that website. I added a subdomain, creted a directory for that subdomain and added L redirect as sugested in some post I found on this forum. Next I created A record for this subdomain in DNS settings.
    Now, while the site itself works a subdomain is not and gives this error:
    Code:
    [Wed May 14 11:28:07 2014] [error] [client xxx.xxx.xxx.xxx] 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.
    [Wed May 14 11:28:07 2014] [debug] core.c(3112): [client xxx.xxx.xxx.xxx] r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /index.php
    [Wed May 14 11:28:07 2014] [debug] core.c(3118): [client xxx.xxx.xxx.xxx] redirected from r->uri = /
    [Wed May 14 11:28:07 2014] [debug] mod_deflate.c(615): [client xxx.xxx.xxx.xxx] Zlib: Compressed 751 to 427 : URL /index.php
    Also a htaccess file for this subdomain looks like this:

    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
     
  2. srijan

    srijan New Member HowtoForge Supporter

    which tutorial you followed for this server??
     
  3. frprim

    frprim New Member

    dd

    Perfect server ubuntu 12.04 :)
     
  4. frprim

    frprim New Member

    Anyone with a idea?
    It seems that Im unable to create subdomain for a website if a root folder for main site is set to subfolder like in my case in:
    /var/www/clients/client1/web1/web/subfolder/
     
  5. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Did you try it with this htaccess rewrite instead of the above?
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ index.php [QSA,L]
     
  6. frprim

    frprim New Member

    Just did, and it returns the same error :(
     
  7. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Could you post your complete vhost file for this domain?
     
  8. frprim

    frprim New Member

    <Directory /var/www/domain.com>
    AllowOverride None
    Order Deny,Allow
    Deny from all
    </Directory>

    <VirtualHost *:80>
    DocumentRoot /var/www/domain.com/web

    ServerName domain.com
    ServerAlias www.domain.com
    ServerAlias subdomain.domain.com
    ServerAdmin [email protected]

    ErrorLog /var/log/ispconfig/httpd/domain.com/error.log

    Alias /error/ "/var/www/domain.com/web/error/"
    ErrorDocument 400 /error/400.html
    ErrorDocument 401 /error/401.html
    ErrorDocument 403 /error/403.html
    ErrorDocument 404 /error/404.html
    ErrorDocument 405 /error/405.html
    ErrorDocument 500 /error/500.html
    ErrorDocument 502 /error/502.html
    ErrorDocument 503 /error/503.html

    <IfModule mod_ssl.c>
    </IfModule>

    <Directory /var/www/domain.com/web>
    Options +FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

    # ssi enabled
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    Options +Includes
    </Directory>
    <Directory /var/www/clients/client1/web15/web>
    Options +FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

    # ssi enabled
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    Options +Includes
    </Directory>

    <IfModule mod_ruby.c>
    <Directory /var/www/domain.com/web>
    Options +ExecCGI
    </Directory>
    RubyRequire apache/ruby-run
    #RubySafeLevel 0
    AddType text/html .rb
    AddType text/html .rbx
    <Files *.rb>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
    </Files>
    <Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
    </Files>
    </IfModule>

    <IfModule mod_perl.c>
    PerlModule ModPerl::Registry
    PerlModule Apache2::Reload
    <Directory /var/www/domain.com/web>
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    Options +ExecCGI
    </Directory>
    <Directory /var/www/clients/client1/web15/web>
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    Options +ExecCGI
    </Directory>
    <Files *.pl>
    SetHandler perl-script
    </Files>
    </IfModule>

    <IfModule mod_python.c>
    <Directory /var/www/domain.com/web>
    <FilesMatch "\.py$">
    SetHandler mod_python
    </FilesMatch>
    PythonHandler mod_python.publisher
    PythonDebug On
    </Directory>
    </IfModule>

    # cgi enabled
    <Directory /var/www/clients/client1/web15/cgi-bin>
    Order allow,deny
    Allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /var/www/clients/client1/web15/cgi-bin/
    <FilesMatch "\.(cgi|pl)$">
    SetHandler cgi-script
    </FilesMatch>
    # suexec enabled
    <IfModule mod_suexec.c>
    SuexecUserGroup web15 client1
    </IfModule>
    # Clear PHP settings of this website
    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler None
    </FilesMatch>
    # mod_php enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected]"
    php_admin_value upload_tmp_dir /var/www/clients/client1/web15/tmp
    php_admin_value session.save_path /var/www/clients/client1/web15/tmp
    # PHPIniDir /var/www/conf/web15
    php_admin_value open_basedir /var/www/clients/client1/web15/web:/var/www/clients/client1/web15/private:/var/www/clients/client1/web15/tmp:/var/www/domain.comf/web:/srv/www/domain.com/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/webdav/
    RewriteCond %{REQUEST_URI} !^/php5-fcgi/
    RewriteCond %{REQUEST_URI} !^/subdomain/
    RewriteRule ^/(.*)$ /subdomain/$1 [L]

    # add support for apache mpm_itk
    <IfModule mpm_itk_module>
    AssignUserId web15 client1
    </IfModule>

    <IfModule mod_dav_fs.c>
    # Do not execute PHP files in webdav directory
    <Directory /var/www/clients/client1/web15/webdav>
    <ifModule mod_security2.c>
    SecRuleRemoveById 960015
    SecRuleRemoveById 960032
    </ifModule>
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler None
    </FilesMatch>
    </Directory>
    DavLockDB /var/www/clients/client1/web15/tmp/DavLock
    # DO NOT REMOVE THE COMMENTS!
    # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
    # WEBDAV BEGIN
    # WEBDAV END
    </IfModule>

    DocumentRoot "/var/www/clients/client1/web15/web/defroot"
    </VirtualHost>
     
  9. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Okay and your subdomain lies in /web/defroot/subdomain/
    If not, then this might be the reason it doesn't work.
     
  10. frprim

    frprim New Member

    I just put it there and same error occours :(

    Thanks alot for helping me out
     
  11. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Okay.. So just try replacing this line in the vhost file:
    Code:
     RewriteRule ^/(.*)$ /subdomain/$1 [L]
    
    by this one
    Code:
     RewriteRule ^/(.*)$ /subdomain/$1 [PT]
    
    for testing.
     
  12. frprim

    frprim New Member

    I got a list of files in that directory including index.php
     
  13. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    What if you call subdomain.yourdomain.com/index.php in browser directly?
     
  14. frprim

    frprim New Member

    It just revert it back to subdomain.mydomain.com
     
  15. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    And if you call something else? Like an image in a subdirectory of the subdomain?
     
  16. frprim

    frprim New Member

    Images are showing up. Php files give white page :)
     
  17. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    What about rewrite log and php errors in the logs when the "white pages" appear?
     
  18. frprim

    frprim New Member

    nothing in rewrite.log and error in log for a domain is the same :(
     
  19. frprim

    frprim New Member

    PM sent.
    Thanks in advance
     

Share This Page