Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Systems > Linux / BSD / OS X

Reply
 
LinkBack Thread Tools Display Modes
Old 05-13-2003, 12:58 PM   #1 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 131
Epsilon is on a distinguished road
Requiring user authentication based on port number

System: RedHat 7.2, Apache 1.3

I disabled the use of .htaccess for per-directory options on my machine and I put all my Auth directives in httpd.conf. It works great, and improves performance. (another tip: Disable SSI. With PHP, SSI has become obsolete and it slows down the server.)

Anyway, I'm trying to figure out a way to configure User Auth against a .htpasswd file only for a certain port. For example, if a request comes in to 12.34.56.78:80 no authentication, but for 12.34.56.78:10000 require valid-user.

I know there must be some way (probably simple) to set this up in the VirtualHost section of httpd.conf, just not sure how. Anyone know?
__________________
--Epsilon--
Epsilon is offline   Reply With Quote
Old 05-16-2003, 10:29 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
Not sure if this is the way you want to do it, but you could have:
Code:
Listen 80
Listen 10000
NameVirtualHost 12.34.56.78:80
NameVirtualHost 12.34.56.78:10000 

<VirtualHost _default_:80>
    ServerAdmin web@domain.com
    DocumentRoot /var/www/open
    ServerName open.domain.com
    ServerAlias open
    ErrorLog logs/open-error.log
    CustomLog logs/open-access.log combined
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/var/www/open">
       Options Indexes FollowSymLinks MultiViews
       AllowOverride None
       Order allow,deny
       Allow from all
    </Directory>
</VirtualHost>

<VirtualHost _default_:10000>
    ServerAdmin web@domain.com
    DocumentRoot /var/www/hidden
    ServerName hide_me.domain.com
    ServerAlias hide_me
    ErrorLog logs/hide_me-error.log
    CustomLog logs/hide_me-access.log combined
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/var/www/hide_me">
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Order allow,deny
       Allow from all
    </Directory>
</VirtualHost>
in your httpd.conf file, if a user is requesting port 10000, then they are directed to a directory, where .htaccess has full control, if its a normal request on port 80, they are directed to a directory, where .htaccess has no permission

I dont know if it is possible to set the same DocumentRoot in both entries or not, since this is an issue I've never tried myself.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 05-16-2003, 12:23 PM   #3 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 131
Epsilon is on a distinguished road
Thanks, I'll give it a try.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic allocation..urgent help needed!!! kashif Standard C, C++ 4 04-21-2003 09:50 AM


All times are GMT -8. The time now is 01:36 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting