[SLUG] Apache Web Server (httpd.conf Configuration file)
Mark Feather
akwexavante at hotmail.com
Mon Mar 10 22:13: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
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" or
ScriptAliasMatch /user(\d)/cgi-bin "/usr/local/ftp/user$1/cgi-bin"
When i use either of the two options above in my Apache config file and restart Apache i get the following error message "ScriptAliasMatch takes two arguments, a regular expression and a fileunused" any ideas or thoughts?
I thought i'd try the following to declare http Alias's with various results to replace the first two lines here
Alias /user1/ "/usr/local/ftp/user1/"
Alias /user2/ "/usr/local/ftp/user2/"
AliasMatch ^/user(.)/ "/usr/local/ftp/user$1/" or
AliasMatch ^/user(\d)/ "/usr/local/ftp/user$1/" or
AliasMatch /user(.)/ "/usr/local/ftp/user$1/" or
AliasMatch /user(\d)/ "/usr/local/ftp/user$1/" or
Alias ?/user(??)/ "/usr/local/ftp/user$1/"
Restarting Apache returns no error message with any one of the options above, but the 1st and 3rd choices return an IE error page "Page cannot be displyed" The 2nd and 4th choices return the IE error page "Page cannot be found" The 5th with the ? marks substituted for any of the other options returns a Server Error page "NOT FOUND"
All choices used return the same error message in the Apache error log "File does not exist /usr/local/httpd/htdocs/user1/index.htm"
This is true, it doesn't exist as it is at /usr/local/ftp/user1/index.htm
Any thoughts or ideas?
Much to my great surprise everything as typed out below works perfectly but i do like the idea of being able to write one line for all users if i can get it to work.
Mark
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/20030310/acafdbd4/attachment.html
More information about the Scarborough
mailing list