PDA

View Full Version : htaccess not working with ISPconfig


comptcarlik
31st August 2008, 12:07
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

Hans
31st August 2008, 13:40
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.

bidevi
31st August 2008, 17:23
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

Hans
31st August 2008, 22:37
@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

bidevi
1st September 2008, 01:34
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, webmaster@mysite.com 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?

bidevi
1st September 2008, 01:57
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.

comptcarlik
1st September 2008, 03:54
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 .

falko
1st September 2008, 18:26
Either put something like

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

in the APache Directives field of that web site in the ISPConfig interface, or...


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 )
... try
<Directory /var/www/*/web>
Options +Includes -Indexes
AllowOverride All
Order allow,deny
Allow from all
<Files ~ "^\.ht">
Deny from all
</Files>
</Directory>
instead.

comptcarlik
2nd September 2008, 11:16
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 .

falko
3rd September 2008, 13:36
Can you post your Vhosts_ispconfig.conf?

comptcarlik
4th September 2008, 12:52
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

falko
5th September 2008, 13:12
I need the vhost configuration of the web site where you want the .htaccess to work.

dimas
17th September 2008, 16:43
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.

falko
18th September 2008, 19:48
Put something like

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

in the Apache Directives field of that web site in the ISPConfig interface.

gamera
19th October 2008, 08:10
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.

gamera
19th October 2008, 12:21
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, webmaster@mythicalsystems.com 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.

falko
20th October 2008, 13:49
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)?

gamera
22nd October 2008, 04:11
There are a few error logs in the directory /var/log/httpd

Here is a link to them:
www.spookyink.net/gamera/varloghttpd.rar

For the error log in /var/www/web#/log:
www.spookyink.net/gamera/varloghttpd.rar

Funny thing about the second log as I see a heap of:
Options not allowed here
[Wed Oct 22 10:03:48 2008] [alert] [client 203.26.95.65] /var/www/web7/web/.htaccess: Options not allowed here

falko
22nd October 2008, 14:27
Can you post the vhost configuration of web7?

gamera
22nd October 2008, 15:44
Sure thing.

www.spookyink.net/gamera/Vhosts_ispconfig.rar

Thanks for taking the time to help.

falko
23rd October 2008, 17:29
Can you post it directly here? That makes it easier for us than downloading and unpacking an archive.

gamera
23rd October 2008, 17:42
###################################
#
# ISPConfig vHost Configuration File
# Version 1.0
#
###################################
#
NameVirtualHost 192.168.1.30:80
<VirtualHost 192.168.1.30:80>
ServerName localhost
ServerAdmin root@localhost
DocumentRoot /var/www/sharedip
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
</VirtualHost>
#
#
######################################
# Vhost: www.mythicalsystems.com:80
######################################
#
#
<VirtualHost 192.168.1.30:80>
<Directory /var/www/web7/web>
AllowOverride All
</Directory>
ServerName www.mythicalsystems.com:80
ServerAdmin webmaster@mythicalsystems.com
DocumentRoot /var/www/web7/web
ServerAlias mythicalsystems.com
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
Alias /cgi-bin/ /var/www/web7/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
ErrorLog /var/www/web7/log/error.log
AddType application/x-httpd-php .php .php3 .php4 .php5
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php3>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php4>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php5>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
php_admin_flag safe_mode On
php_admin_value open_basedir /var/www/web7/
php_admin_value file_uploads 1
php_admin_value upload_tmp_dir /var/www/web7/phptmp/
php_admin_value session.save_path /var/www/web7/phptmp/
<IfModule mod_ruby.c>
<Directory /var/www/web7/web>
Options +ExecCGI
</Directory>
RubyRequire apache/ruby-run
#RubySafeLevel 0
<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
</IfModule>
<IfModule mod_python.c>
<Directory /var/www/web7/web>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride Indexes AuthConfig Limit FileInfo
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
</IfModule>
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Alias /error/ "/var/www/web7/web/error/"
ErrorDocument 400 /error/invalidSyntax.html
ErrorDocument 401 /error/authorizationRequired.html
ErrorDocument 403 /error/forbidden.html
ErrorDocument 404 /error/fileNotFound.html
ErrorDocument 405 /error/methodNotAllowed.html
ErrorDocument 500 /error/internalServerError.html
ErrorDocument 503 /error/overloaded.html
AliasMatch ^/~([^/]+)(/(.*))? /var/www/web7/user/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web7/user/$1/web/$3
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
</VirtualHost>
#
#
#

falko
24th October 2008, 21:57
Does your .htaccess work if you disable Python for web7?

gamera
25th October 2008, 00:28
Turning python off definitely worked!

Question is whether or not I will be needing python later on...

A thousand thanks.

falko
25th October 2008, 12:53
Ok, then the problem was in
<IfModule mod_python.c>
<Directory /var/www/web7/web>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride Indexes AuthConfig Limit FileInfo
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
</IfModule>I should probably change AllowOverride Indexes AuthConfig Limit FileInfo to AllowOverride all I've added this to our bugtracker.