You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jaka Erjavec <ja...@telemach.net> on 2003/10/13 11:02:48 UTC

[users@httpd] Userdir tilde sign, different dirs, etc.

Hello,

Since I did not found similar question on the list I decided to post 
this one.

This is how it goes.

I keep user www pages in directories like this:

/storage/{hexa value of first username character}/{hexa value of second 
username character}/username/www

All the users are virtual ftp users authenticated from pgsql database.

I would like to serve users content in a way it can be seen on the web like:

http://users.domain.com/username -- without ~ sign

What I would probably need is some rewrite rule that would redirect the 
request to the proper userdir. Any suggestions?

Thanks,


Jaka




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Userdir tilde sign, different dirs, etc.

Posted by musicdts <mu...@hotmail.com>.
Just place a file, 'index.html', in the user
directory...
----- Original Message ----- 
From: "Jaka Erjavec" <ja...@telemach.net>
To: <us...@httpd.apache.org>
Sent: Monday, October 13, 2003 4:02 AM
Subject: [users@httpd] Userdir tilde sign,
different dirs, etc.


Hello,

Since I did not found similar question on the list
I decided to post
this one.

This is how it goes.

I keep user www pages in directories like this:

/storage/{hexa value of first username
character}/{hexa value of second
username character}/username/www

All the users are virtual ftp users authenticated
from pgsql database.

I would like to serve users content in a way it
can be seen on the web like:

http://users.domain.com/username -- without ~ sign

What I would probably need is some rewrite rule
that would redirect the
request to the proper userdir. Any suggestions?

Thanks,


Jaka




--------------------------------------------------
-------------------
The official User-To-User support forum of the
Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html>
for more info.
To unsubscribe, e-mail:
users-unsubscribe@httpd.apache.org
   "   from the digest:
users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail:
users-help@httpd.apache.org




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system
(http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release
Date: 10/1/2003

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Userdir tilde sign, different dirs, etc. - fixed

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, 17 Oct 2003, Jaka Erjavec wrote:

> I tried this "prg:" option first with some perl script and it worked
> fine, but slow.
>
> Now I asked a friend of mine to rewrite  (I am not a C programmer at
> all) that perl script in C for better performance, but now we just can
> not get it to return the local path result to Apache.
> In rewrite log file it gets only to:
> -----------
> applying pattern '^/([a-z0-9]+)(.*)' to uri '/jakae'
> ------------
>
> I was wondering if somebody might already have some example C program
> that works in this case.

The script just needs to take input on stdin and write it to stdout.  Make
sure everything is non-buffered, and you shouldn't have a big problem.

But I'm guessing that C won't fix the bottleneck.

It could be that you are running into a problem because all the apache
processes share the same RewriteMap program.  Hence there could be a
backlog waiting for that program to be free.

You'd need to do some careful performance measurement to see if that is
the problem.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Userdir tilde sign, different dirs, etc. - fixed

Posted by Jaka Erjavec <ja...@telemach.net>.
I tried this "prg:" option first with some perl script and it worked 
fine, but slow.

Now I asked a friend of mine to rewrite  (I am not a C programmer at 
all) that perl script in C for better performance, but now we just can 
not get it to return the local path result to Apache.
In rewrite log file it gets only to:
-----------
applying pattern '^/([a-z0-9]+)(.*)' to uri '/jakae'
------------

I was wondering if somebody might already have some example C program
that works in this case.

Thanks,

Jaka


Joshua Slive wrote:

> On Tue, 14 Oct 2003, Jaka Erjavec wrote:
> 
> 
>>Hello,
>>
>>I fixed the problem using the prg as you suggested.
>>Short perl script should do the work as described at the end of
>>http://httpd.apache.org/docs-2.1/misc/rewriteguide.html
>>
>>But I am wondering how CPU intensive it might get under many requests.
>>This way I can also solve the ~ problem.
> 
> 
> Because mod_rewrite keeps the mapping program constantly open and
> communicates with it on a pipe, it shouldn't be too bad.  It is certainly
> much quicker than running a cgi script, which many do on every request.
> 
> What I would be more worried about it stability: both of your script and
> of mod_rewrite.  You need to be very careful with coding your script, and
> you need to be very careful when upgrading apache, because this is a
> complex feature that occasionally gets broken.  But if you do proper
> testing, you should be ok.
> 
> Joshua.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> .
> 



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Userdir tilde sign, different dirs, etc. - fixed

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 14 Oct 2003, Jaka Erjavec wrote:

> Hello,
>
> I fixed the problem using the prg as you suggested.
> Short perl script should do the work as described at the end of
> http://httpd.apache.org/docs-2.1/misc/rewriteguide.html
>
> But I am wondering how CPU intensive it might get under many requests.
> This way I can also solve the ~ problem.

Because mod_rewrite keeps the mapping program constantly open and
communicates with it on a pipe, it shouldn't be too bad.  It is certainly
much quicker than running a cgi script, which many do on every request.

What I would be more worried about it stability: both of your script and
of mod_rewrite.  You need to be very careful with coding your script, and
you need to be very careful when upgrading apache, because this is a
complex feature that occasionally gets broken.  But if you do proper
testing, you should be ok.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Userdir tilde sign, different dirs, etc. - fixed

Posted by Jaka Erjavec <ja...@telemach.net>.
Hello,

I fixed the problem using the prg as you suggested.
Short perl script should do the work as described at the end of
http://httpd.apache.org/docs-2.1/misc/rewriteguide.html

But I am wondering how CPU intensive it might get under many requests.
This way I can also solve the ~ problem.



Thanks,

Jaka


Joshua Slive wrote:

> On Mon, 13 Oct 2003, Jaka Erjavec wrote:
> 
>>I keep user www pages in directories like this:
>>
>>/storage/{hexa value of first username character}/{hexa value of second
>>username character}/username/www
>>
>>All the users are virtual ftp users authenticated from pgsql database.
>>
>>I would like to serve users content in a way it can be seen on the web like:
>>
>>http://users.domain.com/username -- without ~ sign
>>
>>What I would probably need is some rewrite rule that would redirect the
>>request to the proper userdir. Any suggestions?
> 
> 
> This is a slightly tough one.  The only way I can think of doing this is
> using an external "prg" type RewriteMap in mod_rewrite.  Then this program
> would be responsible for doing the conversion from username to directory.
> 
> A more efficient, and possible easier alternative, would be to simply hack
> mod_userdir to handle requests without the ~.
> 
> Joshua.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> .
> 





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Userdir tilde sign, different dirs, etc.

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 13 Oct 2003, Jaka Erjavec wrote:
> I keep user www pages in directories like this:
>
> /storage/{hexa value of first username character}/{hexa value of second
> username character}/username/www
>
> All the users are virtual ftp users authenticated from pgsql database.
>
> I would like to serve users content in a way it can be seen on the web like:
>
> http://users.domain.com/username -- without ~ sign
>
> What I would probably need is some rewrite rule that would redirect the
> request to the proper userdir. Any suggestions?

This is a slightly tough one.  The only way I can think of doing this is
using an external "prg" type RewriteMap in mod_rewrite.  Then this program
would be responsible for doing the conversion from username to directory.

A more efficient, and possible easier alternative, would be to simply hack
mod_userdir to handle requests without the ~.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org