[SOLVED] .htpasswd on virtual host

Support for webhosts that use CentOS
Post Reply
Goldbarry
Posts: 61
Joined: 2007/01/08 20:10:37

[SOLVED] .htpasswd on virtual host

Post by Goldbarry » 2010/08/26 13:31:43

Hi Guys

i am running into some problem with .htpasswd on virtual host apache 2.2.3

here is vitrual hosts


ServerName www.site.com
ProxyPass / http://localhost:70/
ProxyPassReverse / http://localhost:70/


I can't find syntax for implementing
AuthUserFile
AuthGroupFile /dev/null
AuthName
AuthType Basic

hope somebody knows how it can be done

thank you

logan
Posts: 64
Joined: 2008/08/01 16:40:34

Re: .htpasswd on virtual host

Post by logan » 2010/08/26 18:40:09

The context for AuthUserFile and related directives is and .htaccess. My only suggestion to attempt basic auth is:
[code]<VirtualHost *:80>
ServerName www.site.com
ProxyPass / http://localhost:70/
ProxyPassReverse / http://localhost:70/
<Directory />
AuthUserFile ...
AuthName ...
AuthType Basic
require valid-user # or require user ...
</Directory>
</VirtualHost>[/code]

http://httpd.apache.org/docs/current/mod/mod_proxy.html says you can use:
[code]<Proxy *>
Order Deny,Allow
Deny from all
Allow from 192.168.0
</Proxy>[/code]
to limit by IP. That's probably your best shot if basic auth doesn't work.

Goldbarry
Posts: 61
Joined: 2007/01/08 20:10:37

Re: .htpasswd on virtual host

Post by Goldbarry » 2010/08/27 13:16:33

Hi Logan

Thank for your reply

however when i use your suggested config, pop up for user/password doesn't come up


yesterday i was able to make that pop window come up but server could't authenticate user/password provided in the .htpasswd file and the password was changed to be super simple

This is the config on which i have pop up for user/password however is a i said can't get in anyway


ServerName www.site.com

AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/location to the /.htpasswd"
Require valid-user
AllowOverride All
Order allow,deny
Allow from all


ProxyPass / http://localhost:7001/
ProxyPassReverse / http://localhost:7001/




here is the error_log

[Fri Aug 27 09:39:19 2010] [error] [client xx.xx.xx.130] request failed: error reading the headers

mozilla get this message

Bad Request

Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.

Cache-Control: max-age=0, max-age=0, max-age=0, max-age=0, max-age=0, max-a

igro
Posts: 77
Joined: 2010/08/27 00:41:25

Re: .htpasswd on virtual host

Post by igro » 2010/08/29 23:18:56

i think problem in browser.
try 2 clean cache,cookies...try another browser...or try to reinstall mod_auth...

logan
Posts: 64
Joined: 2008/08/01 16:40:34

Re: .htpasswd on virtual host

Post by logan » 2010/09/10 22:23:05

It looks like you combined the and directives and I don't know if you can do that. I've never done any proxy stuff with Apache... The proxy documentation only has examples with IP-based restrictions, but it also links to [url=http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html]mod_authz_host[/url] which talks about using password authentication. If a isn't working, maybe you can try a instead.

Goldbarry
Posts: 61
Joined: 2007/01/08 20:10:37

Re: .htpasswd on virtual host

Post by Goldbarry » 2010/10/04 17:37:37

thanks

managed to fix it

thank you for your help

User avatar
AlanBartlett
Forum Moderator
Posts: 9323
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [SOLVED] .htpasswd on virtual host

Post by AlanBartlett » 2010/10/04 18:07:43

Thank you for reporting back.

For posterity, this thread is marked [SOLVED].

Post Reply

Return to “CentOS 5 - Webhosting Support”