Hi Folks,
I'm going around in ever-tightening circles trying to get
DirectoryIndex /mybin/myindex.cgi
directive to work against a directory within UserDir (ie ~user/public_html).
The platform is SuSE 9.3 with the default installation of Apache 2.0.53. For
the record, the config files are put into /etc/apache2, the ServerRoot
is /srv/www, DocumentRoot is /srv/www/htdocs, and the ordinary CGI is
in /srv/www/cgi-bin.
Ordinary CGI is working from cgi-bin, and also from within DocumentRoot after
applying a few modest config settings. Details later.
To make the DirectoryIndex directive work, I first tried putting the script
into /srv/www/cgi-bin, and after finally getting some clues about suEXEC and
the requirement for scripts to be "under the docroot" I have tried shifting
it to a /srv/www/htdocs/mybin directory. Permissions and owners of all
directories are locked down to the necessary paranoia level described in the
Apache manual page for suEXEC - because I started to see error messages
implying suEXEC is involved.
Here are what I think is the significant configuration directives. Directives
marked with ## are ones I've tried using or commenting out.
ServerRoot /etc/apache2 # to make config files relative
DocumentRoot "/srv/www/htdocs"
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
## ScriptAlias /cgi/ "/srv/www/htdocs/cgi/"
## AddHandler cgi-script .cgi
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>
-- all other Directory below are Order allow,deny; Allow from all;
<Directory "/srv/www/htdocs">
Options +Indexes +FollowSymLinks
</Directory>
<Directory "/srv/www/cgi-bin">
Options +ExecCGI
</Directory>
<Directory "/srv/www/htdocs/cgi">
Options +ExecCGI
</Directory>
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI
DirectoryIndex /cgi/myindex.cgi
<Limit ...
<LimitExcept ...
</Directory>
Currently the myindex.cgi script is a trivial piece of Perl:
#!/usr/bin/perl
use CGI qw(:standard);
use CGI::Carp;
print header, start_html('Test CGI Index'),
"Test CGI index ", `pwd`, end_html();
When it was installed in /srv/www/cgi-bin, and invoked as
http://myhost/cgi-bin/myindex.cgi then I get the expected output.
When it was installed in /srv/www/htdocs/cgi, and invoked as
http://myhost/cgi/myindex.cgi then I get the expected output.
When I try to invoke the script via http://myhost/~username it fails.
error_log contains:
[Thu Sep 08 21:24:12 2005] [error] [client 127.0.0.1] Premature end of script
headers: myindex.cgi
and suexec.log contains:
[2005-09-08 21:24:12]: uid: (400/username) gid: (100/100) cmd: myindex.cgi
[2005-09-08 21:24:12]: command not in docroot
(/srv/www/htdocs/cgi/myindex.cgi)
and the browser shows: (slightly compressed)
Server error! The server encountered an internal error and was unable to
complete your request.
Error message: Premature end of script headers: myindex.cgi
If you think this is a server error, please contact the webmaster.
Error 500
I must be missing some essential detail, but I cannot understand what. What
does it take to make DirectoryIndex work with a CGI?
Thanks in advance,
Andrew Clarke
This email is from Civica Pty Limited and it, together with any
attachments, is confidential to the intended recipient(s) and the
contents may be legally privileged or contain proprietary and private
information. It is intended solely for the person to whom it is
addressed. If you are not an intended recipient, you may not review,
copy or distribute this email. If received in error, please notify the
sender and delete the message from your system immediately. Any views
or opinions expressed in this email and any files transmitted
with it are those of the author only and may not necessarily reflect
the views of Civica and do not create any legally binding rights or
obligations whatsoever. Unless otherwise pre-agreed by exchange of hard
copy documents signed by duly authorised representatives, contracts may
not be concluded on behalf of Civica by email. Please note that neither
Civica nor the sender accepts any responsibility for any viruses and it
is your responsibility to scan the email and the attachments (if any).
All email received and sent by Civica may be monitored to protect the
business interests of Civica.
---------------------------------------------------------------------
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: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]