PDA

View Full Version : Can't get CGI going..


scherpenzeel
15th May 2006, 00:12
Hi I am strugling with the installation of Qmail(rocks.org) on my Debian with apache2. The thing is that when I try to get into http://my.dedicated.server.nl/cgi-bin/vqadmin..etc I get the question if I want to download the file ....:) (no i do not want that..)

I have tried serveralthings the past weeks but it is still not working (learned a lot about apche, debian etc... but not the thing I needed now).

So can anyone help me to get this thing going now? Thanks in advace..:)

So here is what I have got for now:

my config (which I have in sites-enabled/000-default):

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride all
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

# ScriptAlias /cgi-bin/ /var/www/mijn.dedicated.servernation.nl/cgi-bin/
<Directory "/var/www/mijn.dedicated.servernation.nl/cgi-bin/">
allow from all
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# AddHandler cgi-script .cgi .pl
AllowOverride All
Order deny,allow
</Directory>

ErrorLog /var/log/apache2/error.log


# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

Alias /phpMyadmin/ "/var/www/phpMyadmin/"

<Directory "/var/www/phpMyadmin/">
Options MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>


</VirtualHost>
NameVirtualHost *:80

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.


<VirtualHost _default_:*>
</VirtualHost>

#--- hier de welkom pagina van de dedicated server als er geen site is maar wel een domeinnaam / vhost for the dedicated when no site but domain name avialbl.-----

<VirtualHost *:80>
DocumentRoot "/var/www/mijn.dedicated.servernation.nl"
ServerName mijn.dedicated.servernation.nl
ServerAlias mijn.dedicated.servernation.nl
<Directory "/var/www/mijn.dedicated.servernation.nl">
Options -Indexes
</Directory>

#put here the vhosts/ vanaf hier de virtual hosts neerzetten die op de server staan -----

<VirtualHost *:80>
DocumentRoot "/var/www/site1.nl"
ServerName www.site1.nl
ServerAlias site1.nl
<Directory "/var/www/site1.nl">
Options Indexes
</Directory>
</VirtualHost>


<VirtualHost *:80>
DocumentRoot "/var/www/site2.nl"
ServerName www.site2.nl
ServerAlias site2.nl
<Directory "/var/www/site2.nl">
Options Indexes
</Directory>
</VirtualHost>

Additional info:
the rights per vhost / dir:

drwxr-xr-x 3 user www-data 4096 2006-05-01 10:00 website1.nl
drwxr-xr-x 6 user root 4096 2006-05-04 21:31 mijn.dedicated.servernation.nl

drwxr-xr-x 4 user root 4096 2006-04-22 20:32 www.website2.nl
drwxr-xr-x 2 user root 4096 2006-05-01 13:07 www.website3.nl
drwxr-xr-x 2 user www-data 4096 2006-05-01 10:58 www.website4.nl

The test.cgi which I have put in the cgi-bin and gives the same question..

#!/usr/bin/perl

use CGI qw/:standard -no_xhtml/; # load standard CGI routines

print header(), # create the HTTP header
start_html('Hello World demo'), # start the HTML
p('Hello, World.'),
end_html(); # end the HTML

#end of script
This is amongst others in /usr/bin/:

perl
perl5.8.4
perlbug
perlcc
perldoc

Cgi is loaded by apache2 (mods-available)

this is the listing of that vhost:
~# ls -al /var/www/my.dedicated.servernation.nl/cgi-bin/
total 160
drwxr-xr-x 3 user1 user1 4096 2006-05-09 23:26 .
drwxr-xr-x 6 user1 root 4096 2006-05-04 21:31 ..
-rwxr-xr-x 1 root root 84 2006-05-09 17:09 first.pl
-rw-r--r-- 1 user1 user1 137816 2006-05-01 11:02 qmailadmin
-rw-r--r-- 1 root root 308 2006-05-11 16:40 test.cgi
drwxr-xr-x 3 user1 user1 4096 2006-05-01 12:31 vqadmin


ls -al /var/www/my.dedicated.servernation.nl/cgi-bin/vqadmin/
total 116
drwxr-xr-x 3 user1 user1 4096 2006-05-01 12:31 .
drwxr-xr-x 3 user1 user1 4096 2006-05-09 23:26 ..
-rw-r--r-- 1 www-data root 110 2006-05-01 12:31 .htaccess
drwxr-xr-x 2 user1 user1 4096 2006-05-01 11:02 html
-rw-r--r-- 1 user1 user1 864 2006-05-01 11:02 vqadmin.acl
-rw-r--r-- 1 user1 user1 93820 2006-05-01 11:02 vqadmin.cgi

Also: bbout the .htaccess file. I only get the pasword/usern question once? After loggin in I can just refresh the page but I do not get that input screen again. Is the .htaccess chaching me? Is is even working?

falko
15th May 2006, 17:06
Please change

<VirtualHost *:80>
DocumentRoot "/var/www/mijn.dedicated.servernation.nl"
ServerName mijn.dedicated.servernation.nl
ServerAlias mijn.dedicated.servernation.nl
<Directory "/var/www/mijn.dedicated.servernation.nl">
Options -Indexes
</Directory> to

<VirtualHost *:80>
DocumentRoot "/var/www/mijn.dedicated.servernation.nl"
ServerName mijn.dedicated.servernation.nl
ServerAlias mijn.dedicated.servernation.nl
<Directory "/var/www/mijn.dedicated.servernation.nl">
Options -Indexes
</Directory>
ScriptAlias /cgi-bin/ /var/www/mijn.dedicated.servernation.nl/cgi-bin/
AddHandler cgi-script .cgi .pl
<Directory "/var/www/mijn.dedicated.servernation.nl/cgi-bin/">
allow from all
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Order deny,allow
</Directory>
</VirtualHost>

and restart Apache.


Also: bbout the .htaccess file. I only get the pasword/usern question once? After loggin in I can just refresh the page but I do not get that input screen again. Is the .htaccess chaching me? Is is even working?That's normal.

scherpenzeel
15th May 2006, 19:12
Thanks Falko, your great help, "has really made my day"!. Your solution worked instantly. Thanks again.

Sincce I am always interested in the why of things, do I need to have this in al my vhosts, if I want to have cgi working in those as wel? Or will these setting do for all?:D

falko
16th May 2006, 17:56
You need this in all your vhosts.

scherpenzeel
19th May 2006, 00:25
Ok thanks,

now I have qmail working, but cant get Clamav started becouse of this error:

Starting ClamAV daemon: ERROR: Parse error at line 14: Unknown option logFile.
ERROR: Can't open/parse the config file /etc/clamd.conf

this is in the config:
##
## Example config file for the Clam AV daemon
## Please read the clamd.conf(5) manual before editing this file.
##


# Comment or remove the line below.
#Example

# Uncomment this option to enable logging.
# LogFile must be writable for the user running daemon.
# A full path is required.
# Default: disabled
logFile /var/log/clamav/clamd.log

This is what I chown the clamd.log to:
chown clamav:users /var/log/clamav/clamd.log

# ls -al /var/log/clamav/
total 28
drwxr-xr-x 2 clamav clamav 4096 2006-05-18 16:27 .
drwxr-xr-x 12 root root 4096 2006-05-18 08:25 ..
-rw-r--r-- 1 clamav users 3 2006-05-18 15:02 clamd.log
-rw-r----- 1 clamav users 7100 2006-05-18 21:17 clam-update.log
-rw-r----- 1 clamav adm 5394 2006-05-18 22:48 freshclam.log

but stil not working:

falko
19th May 2006, 16:17
Must be
LogFile /var/log/clamav/clamd.log