Operating System - Linux
1826103 Members
4802 Online
109690 Solutions
New Discussion

Apache Server Error 500 -- plz help

 
SOLVED
Go to solution
Maaz
Valued Contributor

Apache Server Error 500 -- plz help

Dear Gurus,

# rpm -q httpd
httpd-2.0.40-21

I have to implement the following scenario
If a client belongs to the network-id of 10, i.e. if client's ip is like 10.x.x.x, then he/she will access the page without asking for username/password from apache server.
But if client's ip is other than 10.x.x.x, he must be asked for username/password by the apache server.

i did the following

# cat /etc/httpd/conf/httpd.conf
.
.
.


Options Indexes FollowSymLinks

AllowOverride AuthConfig


Order allow,deny
Allow from all



# cat /var/www/html/.htaccess
AuthUserFile /tmp/.htpasswd
AuthName "Private"
AuthType Basic
require valid-user
Allow from 10
Satisfy all

Now from any client either from 10.x.x.x, or from 11.x.x.x, when i access the page, following error message receives

Server error!
The server encountered an internal error and was unable to complete your request. Either the

server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster

Error 500
10.0.0.100
Wed 13 Oct 2004 11:30:22 PM PKST
Apache/2.0.40 (Red Hat Linux)

But when I just remove the "Allow from 10", and "Satisfy all" from the /var/www/html/.htaccess, the server works properly, i.e. pages are protected, and offered by entering userid/password

So plz help me, and le me know what i did wrong, and how can I implement the above mentioned scenario

Best Regards
Maaz
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Apache Server Error 500 -- plz help

Gosh,

What a pain.

http://httpd.apache.org

There are instructions there.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bojan Nemec
Honored Contributor

Re: Apache Server Error 500 -- plz help

Maaz,

First try to change the AllowOverride line to:

AllowOverride AuthConfig Limit

This is because Allow is a Limit type. See http://httpd.apache.org/docs-2.0/mod/core.html#allowoverride

Second I think that you must change the Satisfy all line to Satisfy Any to get what you want. All means and (address and password), Any means or (address or password). See http://httpd.apache.org/docs-2.0/mod/core.html#satisfy


Bojan
Maaz
Valued Contributor

Re: Apache Server Error 500 -- plz help

Many Thank SEP, and Bojan Nemec for you kind reply.

Ok, Now server error 500 is removed, as per the instructions, i did the following

in httpd.conf

AllowOverride AuthConfig Limit


in .htaccess
Require valid-user
Allow from 10
Satisfy any

but now apache server doesnt even ask for userid/password to the clients of another network, i.e. if client's ip is 11.x.x.x, then he/she can access the pages, without being prompt for userid/password.

Many Thanks
Regards
Maaz
Bojan Nemec
Honored Contributor
Solution

Re: Apache Server Error 500 -- plz help

Maaz,

This is probably because of Allow from all (or the default). Apache will look if somebody can access the page in this order:

Allow from all
Require valid-user
Allow from 10

Allow from all is good for all clients, so no password ask. To get what you want you must set up the folowing order:

Deny from all
Require valid-user
Allow from 10

So you can put in httpd.conf

AllowOverride AuthConfig Limit


and in .htaccess

Order Deny,Allow
Deny from all
AuthUserFile /tmp/.htpasswd
AuthName "Private"
AuthType Basic
Require valid-user
Allow from 10
Satisfy Any


Bojan
Maaz
Valued Contributor

Re: Apache Server Error 500 -- plz help

I m really highly Thankful to u Dear Bojan Nemec.


Thanks, and Regards,
Maaz