htaccess not working with ISPconfig

Discussion in 'Server Operation' started by comptcarlik, Aug 31, 2008.

  1. comptcarlik

    comptcarlik New Member

    hi . can anyone help . how can i get htaccess to work on a server working perfectly with ISPconfig . this is the first time i am using ISPconfig it really come in handy . so i am afraid to bust something . thanks
     
  2. Hans

    Hans Moderator Moderator

    You can not use .htaccess files for the site, because the use of .htaccess files is not allowed on your system.
    To allow .htaccess files for a single site, enter the following to the apache directives field on the basis tab of the web within ISPConfig:

    <Directory "/var/www/web#/web">
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    Note: web# is the webnumber as created by ISPConfig.

    Alternative:
    Allow the use of .htaccess files on your server globaly, by changing AllowOverride None into AllowOverride All within your Apache configuration file.
    Restart Apache afterwards.
     
  3. bidevi

    bidevi New Member

    more about .htaccess

    Hans wrote:

    Allow the use of .htaccess files on your server globaly, by changing AllowOverride None into AllowOverride All within your Apache configuration file.
    Restart Apache afterwards.


    Sorry Hans, unclear for newbies.

    1. What is the Apache configuration file? Is this etc/apache2/apache2.conf or some other file?

    2. In apache2.conf there are a lot of AllowOverride lines. Which one do we change from what into what or must we add something?

    3. And when you state: Restart Apache afterwards, could you, for the sake of helping newbies, please give the command: /etc/init.d/apache2 force-reload?

    Thanx in advance for your help
     
  4. Hans

    Hans Moderator Moderator

    @bidevi,

    Here is more specific information:

    Within the /etc/apache2/apache2.conf file (somewhere at the end) you find the following lines:

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

    To allow .htaccess files globally on your system (within all the webs created by ISPConfig) change AllowOverride None, into: AllowOverride All

    After saving the configuration file, restart apache2 again with:
    /etc/init.d/apache2 restart or /etc/init.d/apache2 force-reload
     
  5. bidevi

    bidevi New Member

    still no luck with .htaccess

    I followed the instructions as given above.

    Then I opened my browser to open my own webpage which is protected with a .htaccess user & password. It works on my Fedora configuration without ISPConfig.

    With ISPConfig on Debian Etch I get this:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at www.mysite.com Port 80


    Any suggestions?
     
  6. bidevi

    bidevi New Member

    My own stupidity

    Everything works.

    Since the path from .htaccess to .htpasswd is not identical on different systems I had to make adjustments.

    After I did that, everything worked.

    I decided to put this on line for other newbies.
     
  7. comptcarlik

    comptcarlik New Member

    thank you for your help. i guess i am still doing something wrong . first i was a bit afraid to touch the http.conf file since this is the first time i am using ISPconfig i didn't know how it will react after restarting apache .
    i tried all the solution posted above but none seems to work
    i am using fedora 9 so i guess my http.conf file is found under /etc/httpd/conf/http.conf
    first of all i added

    <Directory "/var/www/web#/web">
    Options FollowSymLinks
    AllowOverride All
    </Directory>
    replacing # by the number the server gave me that was 8 on the ISPconfig apache Directives
    (didn't work after rebooting )
    i tried globally both first adding it to the ISPconfig apache directives and the editing my http.conf file ...
    (didn't work after rebooting)
    i also tried

    <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>
    both on the ISPconfig apache directives and the http.conf file
    (still didn't work )
    i was wondering if folder listing could have something to do with it .
    my server doesn't allow folder listing on none of the virtual servers i figure out on our old SUSE server that htaccess only worked if folder listing was allowed . but i am not sure about that .
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Either put something like

    Code:
    <Directory "/var/www/web#/web">
    AllowOverride All
    </Directory>
    in the APache Directives field of that web site in the ISPConfig interface, or...

    ... try
    Code:
    <Directory /var/www/*/web>
    Options +Includes -Indexes
    AllowOverride All
    Order allow,deny
    Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
    </Directory>
    instead.
     
  9. comptcarlik

    comptcarlik New Member

    thanks for your solution falko .
    i guess i have a mis configuration in the apache server . i tried your solution . i still can't get any of them to work .. i guess there is a global directive over taking the optional directives . how can i figure ou what should be commented out in the http.conf file . everytime i make a change i reboot the server hoping it will work . :confused::confused::confused: still not working .
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Can you post your Vhosts_ispconfig.conf?
     
  11. comptcarlik

    comptcarlik New Member

    hello falko .
    i have got 10 websites admistrated by ISPconfig . what part of the files do you need .. the whole thing or just the domain i want the htaccess to work for
     
  12. falko

    falko Super Moderator Howtoforge Staff

    I need the vhost configuration of the web site where you want the .htaccess to work.
     
  13. dimas

    dimas Member

    Dear Falko, I wonder how I could permanently 'fix' this
    AllowOverride All
    setting in Vhosts_ispconfig.conf?

    I change it there for one of the websites from AllowOverride None to AllowOverride All, and everything starts to work, but some time later the setting reverts back to AllowOverride None :(

    Also, I can't reset the setting globally.

    if I put AllowOverride All inside <Directory /var/www/*/web> in /etc/apache2/apache2.conf, nothing seems to happen.

    I have ISPConfig 2.2.25, "perfect setup", Debian Etch.
     
  14. falko

    falko Super Moderator Howtoforge Staff

    Put something like

    Code:
    <Directory "/var/www/web#/web">
    AllowOverride All
    </Directory>
    in the Apache Directives field of that web site in the ISPConfig interface.
     
  15. gamera

    gamera New Member

    Everytime I try and add anything to the directives box withing Basis tab of ISPconfig I get the following:
    You cannot assign HTTPD Includes to this website.

    Now from what I have read to include .htaccess globally you have to edit:
    /etc/apache2/apache2.conf

    But this simply does not exist on centos5.2 I am guessing this is the directory to edit /etc/httpd/conf/http.conf but I did try the edit from the FAQ. But alas no change everytime I add a .htaccess file it disapears from the directory. Even after restarting httpd.

    Can someone please confirm the .conf I need to edit in centos 5.2 and if someone has successfully done it confirm the necessary additional coding please. I would like to allow .htacess globally and not individually.

    Thanks for any advice.
     
  16. gamera

    gamera New Member

    in the httpd.conf file in the directory I stated I changed the setting to AllowOverride All

    Restarted the server. Still wont allow .htaccess files.


    And now I seem to have broken it somehow:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/2.2.3 (CentOS) Server at www.mythicalsystems.com Port 80


    *****NOW FIXED*****

    I logged into server with WinSCP and saw the .ht files sitting there. Funnily enough once gone no more server error. Weird. I am trying to install ravennuke CMS which uses a set of .ht files.

    I am still bewildered that the files go missing in FTP but im sure its a permission issue root vs admin. Interesting that it resulted in server error even though ISPconfig said all is well. Maybe the error was from the CMS and not actual server problem.

    Will try again and hope it works.

    *****NO*****

    Afraid not. the .htaccess files are causing server conflicts. Thus the AllowOverride All did not work. back to the drawing board.


    I have worked out how to use the:
    <Directory "/var/www/web#/web">
    AllowOverride All
    </Directory>

    But still nothing.
     
    Last edited: Oct 19, 2008
  17. falko

    falko Super Moderator Howtoforge Staff

    What's in Apache's overall error log (should be in /var/log/httpd) and in the web site's error log (in /var/www/web#/logs)?
     
  18. gamera

    gamera New Member

  19. falko

    falko Super Moderator Howtoforge Staff

    Can you post the vhost configuration of web7?
     
  20. gamera

    gamera New Member

Share This Page