ChickenSteak
01-19-2003, 12:34 AM
Ok here is the problem... I have a simple cgi script:
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "test\n";
It runs under https, and executes. Although I get a 500 internal server error under http.
http://secure.gurueasy.com/cgi-bin/test.cgi
https://secure.gurueasy.com/cgi-bin/test.cgi
In the suexec log it outputs:
[2003-01-18 23:34:10]: info: (target/actual) uid: (gurueasy/gurueasy) gid: (gurueasy/gurueasy) cmd: test.cgi
[2003-01-18 23:34:10]: error: command not in docroot (/home/gurueasy/htdocs/cgi-bin/test.cgi)
and in the error log it outputs:
[Sat Jan 18 23:34:10 2003] [error] [client 209.251.13.98] Premature end of script headers: /home/gurueasy/htdocs/cgi-bin/test.cgi
Does anyone here have any idea what's wrong? Also in the virtual host entry the script alias is identicle on both the ssl and non ssl. This one has had me going for 24 hours now :-D. All help appreciated.
i am a
01-19-2003, 01:26 AM
it means your suexec binary was compiled with a docroot which doesn't include /home/gurueasy/htdocs/cgi-bin
you can check what the docroot is by issuing the following commands:
$ cd /path/to/suexec
$ ./suexec -V
it'll output the DOC_ROOT. you may have to recompile suexec, or move your file into the DOC_ROOT
2host.com
01-19-2003, 08:52 AM
Originally posted by ChickenSteak
Ok here is the problem... I have a simple cgi script:
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "test\n";
It runs under https, and executes. Although I get a 500 internal server error under http.
http://secure.gurueasy.com/cgi-bin/test.cgi
https://secure.gurueasy.com/cgi-bin/test.cgi
In the suexec log it outputs:
and in the error log it outputs:
Does anyone here have any idea what's wrong? Also in the virtual host entry the script alias is identicle on both the ssl and non ssl. This one has had me going for 24 hours now :-D. All help appreciated.
Likely SSL is running under another virtualhost without the User and Group directives set and it's not executing as the user for SuEXEC anyway, while the other is, or one uses a different path than the other. More information might be needed.
ChickenSteak
01-19-2003, 12:41 PM
Originally posted by i am a
it means your suexec binary was compiled with a docroot which doesn't include /home/gurueasy/htdocs/cgi-bin
you can check what the docroot is by issuing the following commands:
$ cd /path/to/suexec
$ ./suexec -V
it'll output the DOC_ROOT. you may have to recompile suexec, or move your file into the DOC_ROOT
That wouldn't really make any sense for the fact the https is accessing the script from the same location just under "https". Also bandmin is working *not* under https: http://corvette.gurueasy.com/bandwidth which is really weird because the path to bandmin is /usr/local/bandmin/htdocs. Just the users /home/[user]/htdocs/cgi-bin don't work for cgi here is the out put of suexec -V: [root@corvette bin]# ./suexec -V
-D DOC_ROOT="/usr/local/apache/htdocs"
-D GID_MID=100
-D HTTPD_USER="nobody"
-D LOG_EXEC="/usr/local/apache/logs/suexec_log"
-D SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D UID_MID=100
-D USERDIR_SUFFIX="public_html"
Originally posted by 2host.com
Likely SSL is running under another virtualhost without the User and Group directives set and it's not executing as the user for SuEXEC anyway, while the other is, or one uses a different path than the other. More information might be needed.
<IfDefine SSL>
<VirtualHost 209.251.23.37:443>
ServerAdmin webmaster@gurueasy.com
DocumentRoot /home/gurueasy/htdocs
ServerName secure.gurueasy.com
CustomLog /usr/local/apache/domlogs/gurueasy.com-ssl_log "%t %{version}c %{cipher}c %{clientcert}c"
SSLEnable
SSLCertificateFile /usr/local/apache/conf/ssl.crt/gurueasy.com.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/gurueasy.com.key
SSLLogFile /var/log/gurueasy.com
UserDir htdocs
ScriptAlias /cgi-bin/ /home/gurueasy/htdocs/cgi-bin/
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
</IfDefine>
<VirtualHost 209.251.23.37>
#php_admin_flag safe_mode on
ServerAlias www.gurueasy.com secure.gurueasy.com
ServerAdmin webmaster@gurueasy.com
DocumentRoot /home/gurueasy/htdocs
User gurueasy
Group gurueasy
ServerName gurueasy.com
CustomLog domlogs/gurueasy.com combined
ScriptAlias /cgi-bin/ /home/gurueasy/htdocs/cgi-bin/
</VirtualHost>
There are the two VirtualHost entry's. You're right about the part ssl dosen't have user/group although shouldn't the http work with the user/group & isn't that the whole purpose of suexec?
Thanks for help, it's appreciated :).
i am a
01-19-2003, 05:25 PM
nope that all makes sense (i think :) ). suexec is "enabled" by use of the User and Group directive.
note you don't have either in your SSL Virtual Host entry, which means suexec isn't enabled (thus your script works?)
if you add User and Group to your SSL entry, you'll find the same error message i'd suggest.
i'd also ask if you have User/Group values for the bandmin Virtual Host entry?
your DOC_ROOT, as you mention is /usr/local/apache/htdocs, so anything outside of this won't run under Suexec (ie, User/ Group directives)
you'll need to recompile suexec and use a doc_root like /home for example.
ChickenSteak
01-19-2003, 07:06 PM
Oh - you're correct. I've recompiled apache, and it's working :).
http://gurueasy.com/cgi-bin/test.cgi
[root@corvette root]# /usr/local/apache/bin/suexec -V
-D DOC_ROOT="/"
-D GID_MID=100
-D HTTPD_USER="nobody"
-D LOG_EXEC="/usr/local/apache/logs/suexec_log"
-D SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D UID_MID=100
-D USERDIR_SUFFIX="htdocs"