[SLUG] Apache Web Server (httpd.conf Configuration file)

Jonathan Worthington jonathan at jwcs.net
Mon Mar 3 22:30:01 GMT 2003


Hi,

ScriptAlias /user1/cgi-bin/ "/usr/local/ftp/user1/cgi-bin/"

ScriptAlias /user2/cgi-bin/ "/usr/local/ftp/user2/cgi-bin/"


It could get tedious editing the file to add a new line every time you add a site.  You could use a ScriptAliasMatch (I think that's what it's called).  I'm really rusty, but it might be like:-

ScriptAliasMatch ^/user(.)/cgi-bin "/usr/local/ftp/user$1/cgi-bin"

Or it may be better with (if it works):-

ScriptAliasMatch ^/user(\d)/cgi-bin "/usr/local/ftp/user$1/cgi-bin"

But I don't know if \d for digit is available in Apache's pattern matching, I'm only guessing it might work a bit like that in Perl.

Hope this (maybe) helps!

Jonathan
"use Perl;"

--

Jonathan Worthington
Founder, PCO & Director
Executive President, WDD
JWCS.NET Limited

William Street Business Centre
Lower Clark Street
Scarborough
North Yorkshire
England
YO12 7PW
Company Number: 4332599

Phone Number: (0)7005 980 392
Fax Number: (0)7005 802 557

  ----- Original Message ----- 
  From: Mark Feather 
  To: SLUG 
  Sent: Monday, March 03, 2003 12:09 AM
  Subject: [SLUG] Apache Web Server (httpd.conf Configuration file)


  Before i make what will be a significant alteration to my Apache configuration file (httpd.conf) as detailed below, does anybody have any comments or advice!?    Proposed alterations are indented. 



  I want to create cgi-bins in my user account html directories for perl and cgi scripts.  Each user account is actually a diferent project and i want to keep the scripts for each project in its own cgi-bin.   Each users home directory currently has a symlink for redirection to there html directory, these html directories are set as Default root in the (proftpd.conf) configuration file.



  I want to change things for various reasons but mainly to keep projects together in there own directories, each complete with there own scripts. All projects will then be inside the directory (ftp) to allow tarred, compressed backups in one command line for all projects and there subdirectories and files.



  ######################################

  # Aliases: Add here as many aliases as you need (with no limit). The format is 

  # Alias fakename realname

   

  <IfModule mod_alias.c>



  Alias /user1/ "/usr/local/ftp/user1/"

  Alias /user2/ "/usr/local/ftp/user2/"



  <Directory "/usr/local/ftp/user*">

  Authuserfile /etc/httpd/passwd

  AuthGroupfile /etc/httpd/group



  Options -FollowSymLinks +Includes -Multiviews +ExecCGI

  AllowOverride None

  Order allow,deny

  Allow from All



  </Directory>

   

  # Note that if you include a trailing / on fakename then the server will

  # require it to be present in the URL.  So "/icons" isn't aliased in this

  # example, only "/icons/".  If the fakename is slash-terminated, then the 

  # realname must also be slash terminated, and if the fakename omits the 

  # trailing slash, the realname must also omit it.

   

  Alias /icons/ "/usr/local/httpd/icons/"

   

  <Directory "/usr/local/httpd/icons">

  Options Indexes MultiViews

  AllowOverride None

  Order allow,deny

  Allow from all

  </Directory>

   

  # ScriptAlias: This controls which directories contain server scripts.

  # ScriptAliases are essentially the same as Aliases, except that

  # documents in the realname directory are treated as applications and

  # run by the server when requested rather than as documents sent to the client.

  # The same rules about trailing "/" apply to ScriptAlias directives as to

  # Alias.

   

  ScriptAlias /cgi-bin/ "/usr/local/httpd/cgi-bin/"

  ScriptAlias /user1/cgi-bin/ "/usr/local/ftp/user1/cgi-bin/"

  ScriptAlias /user2/cgi-bin/ "/usr/local/ftp/user2/cgi-bin/"

   

  <IfModule mod_perl.c>

  # Provide two aliases to the same cgi-bin directory, 

  # to see the effects of the 2 different mod_perl modes.

  # for Apache::Registry Mode

   

  ScriptAlias /perl/          "/usr/local/httpd/cgi-bin/"

   

  # for Apache::Perlrun Mode

   

  ScriptAlias /cgi-perl/      "/usr/local/httpd/cgi-bin/"

  </IfModule>

   

  # "/usr/local/httpd/cgi-bin" should be changed to whatever your ScriptAliased

  # CGI directory exists, if you have that configured.

   

  <Directory "/usr/local/httpd/cgi-bin">

  AllowOverride None

  Options None

  Order allow,deny

  Allow from all

  </Directory>

   

  <Directory "/usr/local/ftp/user*/cgi-bin">

  AllowOverride None

  Options None

  Order allow,deny

  Allow from all

  </Directory>

   

  </IfModule>

  # End of aliases.

   

  # set /cgi-bin for CGI execution

   

  <Location /cgi-bin>

  AllowOverride None

  Options +ExecCGI +Includes

  SetHandler cgi-script

  </Location>

   

  <Location /user*/cgi-bin>

  AllowOverride None

  Options +ExecCGI +Includes

  SetHandler cgi-script

  </Location>



  ######################################



  At the mo all scripts are in the servers default cgi-bin and a typical link for user1 currently reads <!--#exec cgi = "/cgi-bin/counter.pl"--> when i change things should the link be changed to read <!--#exec cgi = "/user1/cgi-bin/counter.pl"-->



  Mark

   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/scarborough/attachments/20030303/a76c5c34/attachment.html


More information about the Scarborough mailing list