PDA

View Full Version : How do I get cgi working?


waldis
4th December 2006, 04:41
Maybe it sounds stupid, but we all face some stuff for the first time... unless someone is born with knowkedge.

I'm having trouble to get cgi working. I created a website, and it's index.html file is in

there is a cgi-bin folder under /srv/www/web2/ so I dumped all my cgi stuff in there, but from index.html (../cgi-bin/products.cgi?...) points me to http://mywebsite.com:280/cgi-bin/products.cgi?... the same as without ../ and gives me "website cannot display the page"

Then I create cgi-bin in /srv/www/web2/web/ and again I get the same... I keep changing permissions and everything, but I'm not getting anywhere...

Please help.

I'm using SuSE 10.1 installed with ISPConfig as outlined in Perfect setup.

On the website I have checkmarked everything with cgi and php, and actually every single option for it...

Thank you,

Waldis

www.iLoveOK.us

till
4th December 2006, 10:34
The ISPConfig websites are on port 80 and not 280, or did you patch the ISPConfig code to write another Vhost_ispconfig.conf file. Dont mix up the apache server on port 81 which is for the controlpanle only and the 2nd apache on port 80, which is for the websites.

waldis
4th December 2006, 12:19
I changed /etc/apache2/vhosts/Vhosts_ispconfig.conf and /etc/apache2/listen.conf files so it would be on port 280 instead, since my port 80 is blocked from outside, so there is no point sitting on it.

I can access the control panel on port 81 and the website from outside on port 280, just cgi is not working...

Also tried to edit /etc/apache2/default-server.conf and change

ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
to
ScriptAlias /cgi-bin/ "/srv/www/*/cgi-bin/"
to
ScriptAlias /cgi-bin/ "/srv/www/*/web/cgi-bin/"

also <Directory "/srv/www/cgi-bin"> to reflect changes, and restarting Apache, but no good, stil no workie...

falko
5th December 2006, 18:14
What's in your Vhosts_ispconfig.conf? Did you try the test files? http://www.howtoforge.com/forums/showthread.php?t=171

waldis
6th December 2006, 00:31
I can pull up .pl file, and even when I rename it to .txt I can open it thru my browser, but any other files - just wouldn't find them. I'm attaching Vhosts_ispconfig.conf and the output of ls -l /srv/www/web2/cgi-bin/ > cgi-bin.out in a zip file

Thank you!

falko
6th December 2006, 19:19
Please post the contents here directly instead of attaching them in a zip file.

waldis
7th December 2006, 02:03
###################################
#
# ISPConfig vHost Configuration File
# Version 1.0
#
###################################
#
NameVirtualHost 192.168.1.103:280
<VirtualHost 192.168.1.103:280>
ServerName localhost
ServerAdmin root@localhost
DocumentRoot /var/www/sharedip
</VirtualHost>
#
#
######################################
# Vhost: www.mydomain1.com:280
######################################
#
#
<VirtualHost 192.168.1.103:280>
ServerName www.mydomain1.com:280
ServerAdmin webmaster@mydomain1.com
DocumentRoot /srv/www/web1/web
ServerAlias mydomain1.com
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
ScriptAlias /cgi-bin/ /srv/www/web1/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
ErrorLog /srv/www/web1/log/error.log
AddType application/x-httpd-php .php .php3 .php4 .php5
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php3>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php4>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php5>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
php_admin_flag safe_mode On
php_admin_value open_basedir /srv/www/web1/
php_admin_value file_uploads 1
php_admin_value upload_tmp_dir /srv/www/web1/phptmp/
php_admin_value session.save_path /srv/www/web1/phptmp/
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Alias /error/ "/srv/www/web1/web/error/"
ErrorDocument 400 /error/invalidSyntax.html
ErrorDocument 401 /error/authorizationRequired.html
ErrorDocument 403 /error/forbidden.html
ErrorDocument 404 /error/fileNotFound.html
ErrorDocument 405 /error/methodNotAllowed.html
ErrorDocument 500 /error/internalServerError.html
ErrorDocument 503 /error/overloaded.html
AliasMatch ^/~([^/]+)(/(.*))? /srv/www/web1/user/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /srv/www/web1/user/$1/web/$3
</VirtualHost>
#
#
#
######################################
# Vhost: www.mydomain2.com:280
######################################
#
#
<VirtualHost 192.168.1.103:280>
ServerName www.mydomain2.com:280
ServerAdmin webmaster@mydomain2.com
DocumentRoot /srv/www/web2/web
ServerAlias mydomain2.com
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
ScriptAlias /cgi-bin/ /srv/www/web2/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
ErrorLog /srv/www/web2/log/error.log
AddType application/x-httpd-php .php .php3 .php4 .php5
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php3>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php4>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php5>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
php_admin_flag safe_mode On
php_admin_value open_basedir /srv/www/web2/
php_admin_value file_uploads 1
php_admin_value upload_tmp_dir /srv/www/web2/phptmp/
php_admin_value session.save_path /srv/www/web2/phptmp/
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Alias /error/ "/srv/www/web2/web/error/"
ErrorDocument 400 /error/invalidSyntax.html
ErrorDocument 401 /error/authorizationRequired.html
ErrorDocument 403 /error/forbidden.html
ErrorDocument 404 /error/fileNotFound.html
ErrorDocument 405 /error/methodNotAllowed.html
ErrorDocument 500 /error/internalServerError.html
ErrorDocument 503 /error/overloaded.html
AliasMatch ^/~([^/]+)(/(.*))? /srv/www/web2/user/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /srv/www/web2/user/$1/web/$3
</VirtualHost>
#
#
#




total 316
-rw-r--r-- 1 root web2 0 Dec 1 01:54 .csc
-r-------- 1 root root 0 Dec 1 01:54 .no_delete
-rwxr-xr-x 1 root root 31333 Dec 3 19:07 bg.gif
-rwxr-xr-x 1 root root 6317 Dec 3 19:07 cgi.cpp
-rwxr-xr-x 1 root root 115 Dec 3 19:07 cgi.h
-rw-r--r-- 1 root root 6071 Oct 24 01:21 cgi.txt
-rwxr-xr-x 1 root root 3156 Dec 3 19:07 comp_details.html
-rwxr-xr-x 1 root root 444 Dec 3 19:07 comp_detailsRow.html
-rwxr-xr-x 1 root root 3149 Dec 3 19:07 companies.cpp
-rwxr-xr-x 1 root root 791 Dec 3 19:07 companies.h
-rwxr-xr-x 1 root root 2088 Dec 3 19:07 companies.html
-rwxr-xr-x 1 root root 203 Dec 3 19:07 companiesRow.html
-rwxr-xr-x 1 root root 1640 Dec 3 19:07 customers.bin
-rwxr-xr-x 1 root root 240 Dec 3 19:07 customers.cpp
-rwxr-xr-x 1 root root 423 Dec 3 19:07 customers.h
-rwxr-xr-x 1 root root 421 Dec 3 19:07 customers.h~
-rwxr-xr-x 1 root root 379 Dec 4 04:58 hello_world.pl
-rwxr-xr-x 1 root root 379 Dec 4 05:09 hello_world.txt
-rwxr-xr-x 1 root root 544 Dec 3 19:07 items.h
-rwxr-xr-x 1 root root 11202 Dec 3 19:07 main.cpp
-rwxr-xr-x 1 root root 4319 Dec 3 19:07 prd_details.html
-rwxr-xr-x 1 root root 288 Dec 3 19:07 prd_detailsRow.html
-rwxr-xr-x 1 root root 4624 Dec 3 19:07 products.bin
-rwxr-xr-x 1 root root 143432 Dec 3 19:07 products.cgi
-rwxr-xr-x 1 root root 2313 Dec 3 19:07 products.cpp
-rwxr-xr-x 1 root root 650 Dec 3 19:07 products.h
-rwxr-xr-x 1 root root 2659 Dec 3 19:07 products.html
-rwxr-xr-x 1 root root 358 Dec 3 19:07 productsRow.html
-rwxr-xr-x 1 root root 1640 Dec 3 19:07 suppliers.bin
-rwxr-xr-x 1 root root 746 Dec 3 19:07 suppliers.cpp
-rwxr-xr-x 1 root root 423 Dec 3 19:07 suppliers.h
-rwxr-xr-x 1 root root 421 Dec 3 19:07 suppliers.h~

falko
7th December 2006, 17:26
Looks ok. Does hello_world.pl work then?