You are not logged in.

#1 2004-01-14 15:10:46

zen_guerrilla
Member
From: Greece
Registered: 2002-12-22
Posts: 259

Apache, virtual hosts & cgi-bin

Hello all,
I have an AL server running apache, qmail, vpopmail (&mysql), bincimap, squirrelmail.
I've setup apache to have 2 virtual hosts :
www.mydomain.com (with docroot /home/httpd/html/www.mydomain.com) as http & mail.mydomain.com (with docroot /home/httpd/html/mail.mydomain.com) as https.
Everything is working fine so far, except when I ask for http://mail.mydomain.com (not https) it shows the contents of www.mydomain.com. Minor annoyance, but I'd like to fix it some time. Any suggestions ?
My main problem is that I want to install qmailadmin in mail.mydomain.com, so I can access it via ssl, so I installed it as /home/httpd/cgi-bin/qmailadmin & made a symlink to /home/httpd/html/mail.mydomain.com/cgi-bin.
When I try to access it (https://mail.mydomain.com/cgi-bin/qmailadmin), I get "500 Internal server error" & in error_log:

[error] [client MY_IP] Premature end of script headers: qmailadmin

and in ssl_request_log :

[14/Jan/2004:17:00:45 +0200] MY_IP TLSv1 RC4-MD5 "GET /cgi-bin/qmailadmin HTTP/1.1" 674

I've never setup cgi-bin in virtual hosts before & it's driving me nuts, any suggestions ?
btw, qmailadmin works fine on my home server without any virtual hosts in apache...

Offline

#2 2004-01-14 17:47:25

farphel
Forum Fellow
From: New Hampshire - USA
Registered: 2003-09-18
Posts: 250
Website

Re: Apache, virtual hosts & cgi-bin

This isn't perfect, but it's probably pretty close to what you're looking for.  You may need to play around with some <Directory/> tags for your cgi-bin directory, or (as the example illustrates below), just put your cgi scripts in the document root for mail.mydomain.com.

<Directory "/home/httpd/html/www.mydomain.com">
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory "/home/httpd/html/mail.mydomain.com">
    AllowOverride All
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

NameVirtualHost 192.168.1.114:80
NameVirtualHost 192.168.1.114:443

<VirtualHost www.mydomain.com:80>
  SSLDisable
  Servername www.mydomain.com
  ServerAdmin         admin_dude@mydomain.com
  DocumentRoot        /home/httpd/html/www.mydomain.com
  DirectoryIndex      index.html index.htm index.cgi
  ErrorLog            logs/www.mydomain.com_error.log
  CustomLog           logs/www.mydomain.com_access.log combined
</Virtualhost>

# redirect 80 to 443
<VirtualHost mail.mydomain.com:80>
  SSLDisable
  Servername mail.mydomain.com
  Redirect / https://mail.mydomain.com
</Virtualhost>

<VirtualHost mail.mydomain.com:443>
  SSLEnable
  SSLCertificateFile /home/httpd/conf/mail.mydomain.com.pem
  ServerName          mail.mydomain.com
  ServerAdmin         admin_dude@mydomain.com
  DocumentRoot        /home/httpd/html/mail.mydomain.com
  ErrorLog            logs/mail.mydomain.com_error.log
  CustomLog           logs/mail.mydomain.com_access.log combined
</Virtualhost>

hth,
farphel


Follow the link below, sign up, and accept one promotional offer.  If I can get five suckers (err... friends) to do this, I'll get a free iPod.  Then you too can try to get a free iPod. Thanks! http://www.freeiPods.com/?r=11363142

Offline

#3 2004-01-14 19:35:38

zen_guerrilla
Member
From: Greece
Registered: 2002-12-22
Posts: 259

Re: Apache, virtual hosts & cgi-bin

Thanx for answering, the Redirect option solved my 1st problem. However I can't launch qmailadmin no matter what, I always get "500 Internal server error". Any other suggestions ?

Offline

#4 2004-01-14 21:02:21

farphel
Forum Fellow
From: New Hampshire - USA
Registered: 2003-09-18
Posts: 250
Website

Re: Apache, virtual hosts & cgi-bin

You might need to rename the qmailadmin script to qmailadmin.cgi and make sure you have an AddHandler defined in your httpd.conf.  Also make sure the qmailadmin[.cgi] script is executable (which I'm sure you did already, but just to be thorough smile)


Follow the link below, sign up, and accept one promotional offer.  If I can get five suckers (err... friends) to do this, I'll get a free iPod.  Then you too can try to get a free iPod. Thanks! http://www.freeiPods.com/?r=11363142

Offline

#5 2004-01-15 06:32:51

zen_guerrilla
Member
From: Greece
Registered: 2002-12-22
Posts: 259

Re: Apache, virtual hosts & cgi-bin

Thanx for answering, farphel. Actually qmailadmin is not a script per se, it's a complete program written in C. It's installed with 6755 perms mode & vpopmail.vchkpw ownership, so yes it's executable smile.
I'll google it some more later today & if I find a solution I'll post it here to save time to fellow archers in the future smile.

Offline

#6 2004-01-16 09:55:40

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: Apache, virtual hosts & cgi-bin

I beleive the error logs of apache should show some more hints what went wrong. That's usually the first thing I check, when I get internal errors. Also, redirecting stderr and stdout may help.

About the first problem : Check the handling of default domains in the apache docs. It took me a few attempts to get my servers right ;-)

Offline

Board footer

Powered by FluxBB