ISPConfig, Drupal, and .htaccess

Discussion in 'General' started by jon335, Oct 8, 2005.

  1. jon335

    jon335 New Member

    I am trying to install Drupal for my website, but I am running into a problem. When I go to my website I get:
    500 Internal Server Error

    I uploaded all the files for drupal, created the database, and edited the settings file for my site.

    Here is part of the log:

    Code:
    [B]error.log[/B]
    [Sat Oct 08 10:54:09 2005] [alert] [client 192.168.1.230] /var/www/web1/web/.htaccess: Options not allowed here
    [Sat Oct 08 10:54:09 2005] [alert] [client 192.168.1.230] /var/www/web1/web/.htaccess: Options not allowed here
    [Sat Oct 08 10:54:09 2005] [alert] [client 192.168.1.230] /var/www/web1/web/.htaccess: Options not allowed here
    [Sat Oct 08 10:54:09 2005] [alert] [client 192.168.1.230] /var/www/web1/web/.htaccess: Options not allowed here
    [Sat Oct 08 10:54:09 2005] [alert] [client 192.168.1.230] /var/www/web1/web/.htaccess: Options not allowed here
    [Sat Oct 08 10:54:09 2005] [alert] [client 192.168.1.230] /var/www/web1/web/.htaccess: Options not allowed here

    Code:
    [B].htaccess[/B]
    #
    # Apache/PHP/Drupal settings:
    #
    
    # Protect files and directories from prying eyes.
    <Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
      Order deny,allow
      Deny from all
    </Files>
    
    # Set some options.
    Options -Indexes
    Options +FollowSymLinks
    
    # Customized error messages.
    ErrorDocument 404 /index.php
    
    # Set the default handler.
    DirectoryIndex index.php
    
    # Override PHP settings. More exist in sites/default/settings.php, but
    # the following cannot be changed at runtime. The first IfModule is
    # for Apache 1.3, the second for Apache 2.
    <IfModule mod_php4.c>
      php_value magic_quotes_gpc                0
      php_value register_globals                0
      php_value session.auto_start              0
    </IfModule>
    
    <IfModule sapi_apache2.c>
      php_value magic_quotes_gpc                0
      php_value register_globals                0
      php_value session.auto_start              0
    </IfModule>
    
    # Reduce the time dynamically generated pages are cache-able.
    <IfModule mod_expires.c>
      ExpiresByType text/html A1
    </IfModule>
    
    # Various rewrite rules.
    <IfModule mod_rewrite.c>
      RewriteEngine on
    
      # Modify the RewriteBase if you are using Drupal in a subdirectory and
      # the rewrite rules are not working properly.
      #RewriteBase /drupal
    
      # Rewrite old-style URLs of the form 'node.php?id=x'.
      #RewriteCond %{REQUEST_FILENAME} !-f
      #RewriteCond %{REQUEST_FILENAME} !-d
      #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
      #RewriteRule node.php index.php?q=node/view/%1 [L]
    
      # Rewrite old-style URLs of the form 'module.php?mod=x'.
      #RewriteCond %{REQUEST_FILENAME} !-f
      #RewriteCond %{REQUEST_FILENAME} !-d
      #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
      #RewriteRule module.php index.php?q=%1 [L]
    
      # Rewrite current-style URLs of the form 'index.php?q=x'.
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </IfModule>
    
    # $Id: .htaccess,v 1.66 2005/03/20 19:15:00 dries Exp $
    
    What should I do?? :confused: :confused:
     
    Last edited: Oct 8, 2005
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    At the end of your httpd.conf is a section like this:

    Code:
    <Directory /home/www/*/web>
        Options +Includes +FollowSymlinks -Indexes
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
    
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    There you must chnage the AllowOverride statement to allow all settings in the drupal .htaccess file. For test purposes you might even change it to: AllowOverride All

    Then restart your apache webserver.
     
  3. jon335

    jon335 New Member

    Where is httpd.conf located?

    I'm using the Ubuntu 5.04 Perfect Setup.
     
    Last edited: Oct 8, 2005
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    In Ubuntu the httpd.conf file is named /etc/apache2/apache2.conf
     
  5. jon335

    jon335 New Member

    Thanks, that worked perfectly. Is it OK to leave the AllowOverride setting set to All, or should I set it to something else?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    AllowOverride All means that all settings allowed in the vhost configuration can be overridden with .htaccess files. Thats insecure because your customers are able to change their apache configuration. Maybe you have a look at the apache.org website, there is a documentation what settings are allowed with allow override and you can decide which rights you want to give to your customers.
     
  7. falko

    falko Super Moderator Howtoforge Staff

    Hi jon335,

    here's another thread that might be interesting for you: http://www.howtoforge.com/forums/showthread.php?t=38

    It has nothing to do with your problem in this thread, but it has also to do with Drupal (and apache rewrite rules). :) In case you run into the same problems when playing around with Drupal... ;)
     
  8. stamy

    stamy New Member

    I've got it !

    The solution was to modify this file: /etc/apache2/apache2.conf

    <Directory /home/www/*/web>
    Options +Includes +FollowSymlinks -Indexes
    #===============HERE==============
    AllowOverride All
    #=================================
    Order allow,deny
    Allow from all

    <Files ~ "^\.ht">
    Deny from all
    </Files>
    </Directory>

    Thank's all for your help (maybe there is a cleaner way to do that, lower risk without using "All" for AllowOverride options).
     
  9. minskog

    minskog New Member

    I do it, but dont works for me:

    Code:
    <Directory /usr/var/www/virtual/*/web>
        Options +Includes -Indexes
        AllowOverride All
        #AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    
    
    Gives error 500.
     
  10. falko

    falko Super Moderator Howtoforge Staff

    What's in your Apache error log?
     
  11. stamy

    stamy New Member

    Have you restarted apache ?
    Your web pages are locatd under /home/www/virtual/*/web and not under /home/www/*/web ?
     
  12. pinz0

    pinz0 New Member

    same problems with drupal on Ubuntu 6.06

    hello -
    i was reading these entries and tried to fix my problems.
    since i've put drupal into my /home/web6/web/cms - directory, i have the
    "500 Internal Server Error".


    my httpd.conf looks like this:

    Code:
    <Directory /home/*/user/*/web>
        Options +Includes -Indexes
        AllowOverride All
    #  AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    

    and the .htaccess-file looks like this:

    Code:
    #
    # Apache/PHP/Drupal settings:
    #
    
    # Protect files and directories from prying eyes.
    <FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root)$">
      Order deny,allow
      Deny from all
    </FilesMatch>
    
    # Set some options.
    Options -Indexes
    Options +FollowSymLinks
    
    # Customized error messages.
    ErrorDocument 404 /index.php
    
    # Set the default handler.
    DirectoryIndex index.php
    
    # Override PHP settings. More in sites/default/settings.php
    # but the following cannot be changed at runtime.
    
    # PHP 4, Apache 1
    <IfModule mod_php4.c>
      php_value magic_quotes_gpc                0
      php_value register_globals                0
      php_value session.auto_start              0
    </IfModule>
    
    # PHP 4, Apache 2
    

    this is in the LOG-file (/home/web6/log):

    Code:
    [Wed Aug 02 10:23:16 2006] [alert] [client 85.125.230.181] /home/web6/web/.htaccess: Options not allowed here


    so, i really don't know how to make it work properly.
    Please folks, help me!
     
    Last edited: Aug 2, 2006
  13. geek.de.nz

    geek.de.nz New Member

    change to

    Code:
    <Directory /home/*/user/*/web>
        Options +Includes -Indexes
        AllowOverride All
    #  AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
    #    <Files ~ "^\.ht">
    #   Deny from all
    #    </Files>
    </Directory>
    
    Try this. I'm not sure if that will work, but I think
    Code:
    <Files ~ "^\.ht">
       Deny from all
    </Files>
    
    prevents .htaccess to be loaded. "^\.ht" is a regular expression matching files beginning with ".ht", so .ht*.

    I could be mistaken though. Have a look at the docs on the apache website.
     
  14. falko

    falko Super Moderator Howtoforge Staff

    Code:
    <Directory /home/*/user/*/web>
        Options +Includes -Indexes
        AllowOverride All
    #  AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    is the wrong stanza.

    It's this stanza:

    Code:
    <Directory /home/*/web>
        Options +Includes -Indexes
        AllowOverride None
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    that you must change.
     
  15. pinz0

    pinz0 New Member

    THANKS!

    it works now! many thanks for the quick help.
    bests!
     
  16. pinz0

    pinz0 New Member

    another problem!

    hello again,

    another problem showed up with isp-config and drupal :( .
    for some reason it is not possible to view uploaded files.
    if i click on the link of the uploaded file the server again posts the "500 error".

    is there someone who can help me with that problem?

    bests!
     
    Last edited: Aug 4, 2006
  17. falko

    falko Super Moderator Howtoforge Staff

    The problem is the .htaccess file in your files directory. If you remove it, it should work, but as far as I know this opens a security hole so this is not recommended...
     
  18. pinz0

    pinz0 New Member

    thanks for your response.

    yes, if i rename or remove the .htaccess-file in /files, than it works fine, but as you mention, this can't be the way..

    any recommendations for the .htaccess - file or for another back door-solution?
     
  19. pinz0

    pinz0 New Member

    Ok!

    ok, i think i have a solution for the problem.
    i pasted this into /etc/apache2/apache2.conf:

    Code:
    <Directory /home/*/web/drupal/files>
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    
    i think, that this works for all drupal-installs on the server.

    bests!
     
  20. nzimas

    nzimas Member

    Puzzling.

    I have tried several recipes to allow .htaccess overrides and still get the error 500.

    my apache2.conf looks like:

    Code:
    <Directory /var/www/*/web>
        Options +Includes -Indexes
        AllowOverride All
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
    </Directory>
    
    The error log reports:

    Sat Jun 16 20:49:50 2007] [alert] [client 83.165.10.237] /var/www/web2/web/.htaccess: Options not allowed here, referer: http://www.familythrive.com/administrator/index2.php?option=com_sef&task=showconfig

    I have this actual web located at /var/www/web2/web/

    Do i need to tweak anything at /etc/apache2/vhosts/Vhosts_ispconfig.con?

    Thanks,
    Nuno.
     

Share This Page