I'm hitting a snag with htaccess. Have created .htaccess and .htpasswd files, set up apache directory options just like always... the exact same setup works fine on CentOS 3, but I can't seem to get it to authenticate on CentOS 4? Am I just being blind stupid (as in not seeing something 'exactly the same') or is there something different I'm missing? I have selinux running in warn mode I think it was, but not fully enabled.
Best, John Hinton
On 7/23/05, John Hinton webmaster@ew3d.com wrote:
I'm hitting a snag with htaccess. Have created .htaccess and .htpasswd files, set up apache directory options just like always... the exact same setup works fine on CentOS 3, but I can't seem to get it to authenticate on CentOS 4? Am I just being blind stupid (as in not seeing something 'exactly the same') or is there something different I'm missing? I have selinux running in warn mode I think it was, but not fully enabled.
Well, operating off the assumption of blind stupidity... you *did* remember the AllowOverride option to be able to actually use htaccess files right? Just to be safe, you might also ls -Z the files to be sure they have the proper context for selinux. I've heard rumors of selinux causing issues with apps in warn mode, but I've not actually experienced it.
-- Jim Perrin System Administrator - UIT Ft. Gordon & US Army Signal Center
I'm hitting a snag with htaccess. Have created .htaccess and .htpasswd files, set up apache directory options just like always... the exact same setup works fine on CentOS 3, but I can't seem to get it to authenticate on CentOS 4? Am I just being blind stupid (as in not seeing something 'exactly the same') or is there something different I'm missing? I have selinux running in warn mode I think it was, but not fully enabled.
Best, John Hinton
Hello, John.
The problem might be that you have the mod_auth_mysql module enabled. Please have a look at your '/var/log/httpd/ssl_error_log' file. If you find an error like the following: 'MySQL ERROR: Table 'test.user_info' doesn't exist' Then it means that the mod_auth_mysql module is enabled, making Apache to look for the permissions in the MySQL database, and completely forgetting the .htaccess and .htpasswd files.
In this case, just remove the module like this:
yum remove mod_auth_mysql or rpm -e mod_auth_mysql
And then restart apache: 'service httpd restart'
Then it should work. This is a strange behaviour I know, but it doesn't bother anybody, appart of those using that function unfortunately...
Else, please report the error that you receive in your /var/log/httpd/ssl_error_log' file.
Regards, Daniel
dan1 wrote:
I'm hitting a snag with htaccess. Have created .htaccess and .htpasswd files, set up apache directory options just like always... the exact same setup works fine on CentOS 3, but I can't seem to get it to authenticate on CentOS 4? Am I just being blind stupid (as in not seeing something 'exactly the same') or is there something different I'm missing? I have selinux running in warn mode I think it was, but not fully enabled.
Best, John Hinton
Hello, John.
The problem might be that you have the mod_auth_mysql module enabled. Please have a look at your '/var/log/httpd/ssl_error_log' file. If you find an error like the following: 'MySQL ERROR: Table 'test.user_info' doesn't exist' Then it means that the mod_auth_mysql module is enabled, making Apache to look for the permissions in the MySQL database, and completely forgetting the .htaccess and .htpasswd files.
In this case, just remove the module like this:
yum remove mod_auth_mysql or rpm -e mod_auth_mysql
And then restart apache: 'service httpd restart'
Then it should work. This is a strange behaviour I know, but it doesn't bother anybody, appart of those using that function unfortunately...
Else, please report the error that you receive in your /var/log/httpd/ssl_error_log' file.
Regards, Daniel
I did have mod_auth_mysql installed, but it doesn't seem to be the problem. Removed it just in case. I have been back through again and again.... compared this machine with another CentOS 4 install (forgot about my success on that machine), where I'm not having any trouble. The only difference that is obvious to me between the two machines, is that yes I do have selinux installed in the 'warning only' mode on the troublesome box.
While trying to make things as indentical as possibly between the two machines, I found different perms on the .htaccess and .htpasswd files, so I changed them... still no go
-rw-r--r-- root root root:object_r:httpd_sys_content_t .htaccess
are the perms I now have set on both files. Of course the other machine doesn't do a return on ls -Za
[Sun Jul 24 12:57:04 2005] [warn] RSA server certificate CommonName (CN) `localhost.localdomain' does NOT match server name!?
Are the only entries from ssl_error_log and they show only during restart of apache. I don't have a domain on this machine that I'd like to set as the default ssl domain, so I haven't done much with the ssl conf settings other than entering the server IP.
Another difference between the two boxes, is the working box is a single domain box, so .htaccess is on the root domain. The one not working is a vhost on the box. I know that 'could' make a difference, but if it does I'm going to be really bothered!
I have hit logs everywhere I can think to look and I can't find anything! It's like apache is simply not finding the .htaccess file, in spite of being told to look for one. I even tried adding AccessFileName .htaccess inside the virtualhost directive, and that didn't do anything either. It does exist in the main server conf area. WOW!!! I've never had such trouble!!!
So, I disabled selinux, rebooted and still have the same issue..... I guess it's time to go off in another direction... get it working somewhere else, and then try to figure out what I've missed. I must be overlooking something... but darn if I've ever had it hidden so well.
Thanks John Hinton
Are the only entries from ssl_error_log and they show only during restart of apache. I don't have a domain on this machine that I'd like to set as the default ssl domain, so I haven't done much with the ssl conf settings other than entering the server IP.
Another difference between the two boxes, is the working box is a single domain box, so .htaccess is on the root domain. The one not working is a vhost on the box. I know that 'could' make a difference, but if it does I'm going to be really bothered!
I have hit logs everywhere I can think to look and I can't find anything! It's like apache is simply not finding the .htaccess file, in spite of being told to look for one. I even tried adding AccessFileName .htaccess inside the virtualhost directive, and that didn't do anything either. It does exist in the main server conf area. WOW!!! I've never had such trouble!!!
So, I disabled selinux, rebooted and still have the same issue..... I guess it's time to go off in another direction... get it working somewhere else, and then try to figure out what I've missed. I must be overlooking something... but darn if I've ever had it hidden so well.
OH crap.... I'm truly an idiot!!!! Beat myself to death on this.... and I don't seem to be able to 'see' that I have made an idiot's mistake forgetting to include public_html in the path to my directory. Right there... all the time... right IN my FACE!!!
I'm so sorry for wasting everyone's time. <hugely embarrassed>.
I am just a little surprised that apache even restarted though. Most of the time if a directory doesn't exist, it's pretty flaky. I think that's why I wasn't really looking so hard at that. Man, I checked the spelling of the path about 100 times... but...........
I'll have the better half cook up a hot noodle right now, and start receiving my 50 lashes!
Thanks John Hinton <with much egg on his face>
OH crap.... I'm truly an idiot!!!! Beat myself to death on this.... and I don't seem to be able to 'see' that I have made an idiot's mistake forgetting to include public_html in the path to my directory. Right there... all the time... right IN my FACE!!!
I'm so sorry for wasting everyone's time. <hugely embarrassed>.
I am just a little surprised that apache even restarted though. Most of the time if a directory doesn't exist, it's pretty flaky. I think that's why I wasn't really looking so hard at that. Man, I checked the spelling of the path about 100 times... but...........
I'll have the better half cook up a hot noodle right now, and start receiving my 50 lashes!
Thanks John Hinton <with much egg on his face>
Hello, John.
Don't hit to strong.. often there are so many options to look for that obvious things are quite difficult to find out.
Enjoy..
Daniel