Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cant make cgi work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
rogerdv
Apprentice
Apprentice


Joined: 01 Apr 2006
Posts: 185
Location: Santiago, Cuba

PostPosted: Tue Aug 25, 2009 8:14 pm    Post subject: cant make cgi work Reply with quote

After reinstalling my server I have found that ther eis no way to make cgis work again. I have checked the configurations, I think I have the module (mod_cgi.so), but still they dont work, always get an error about inexistent page. Im using apache 2.2.11 and copied the same configuration I was using before.
This is my virtual host configuration:

Code:
<IfDefine DEFAULT_VHOST>
<VirtualHost 192.168.1.1:80>
    ServerName eht
    ServerAdmin root@ehtsc.co.cu
   
    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "/var/www/localhost/htdocs"
    CustomLog /var/log/apache2/in-access_log common

    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/var/www/localhost/htdocs">

        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs-2.0/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks
   

        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride All

        #
        # Controls who can get stuff from this server.
        #
        Order allow,deny
        Allow from all
    </Directory>
   
    <IfModule alias_module>
            ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/"
    </IfModule>
   
    # "/var/www/localhost/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    <Directory "/var/www/localhost/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>

    <IfModule peruser.c>
        # this must match a Processor
        ServerEnvironment apache apache

        # these are optional - defaults to the values specified in httpd.conf
        MinSpareProcessors 4
        MaxProcessors 20
    </IfModule>

    <IfModule itk.c>
        # The userid and groupid this VirtualHost will run as
        AssignUserID apache apache

        # Optional: A separate MaxClients for the VirtualHost,
        # to limit the maximum number of processes
        MaxClientsVHost 50

        # Note that if you do not assign a user ID for your
        # VirtualHosts, none will be assigned by default,
        # ie. you'll run as root. Don't forget this!
    </IfModule>
</VirtualHost>


I have googled and it seems to be correct. Any idea about what Im missing here?
_________________
Game programming news for newbies | The Ark, making an RPG the right way!
Back to top
View user's profile Send private message
DawgG
l33t
l33t


Joined: 17 Sep 2003
Posts: 866

PostPosted: Wed Aug 26, 2009 11:20 am    Post subject: Reply with quote

at first sight, i found that you have not configured cgi:

Quote:
You could explicitly use the Options directive, inside your main server configuration file, to specify that CGI execution was permitted in a particular directory:

Code:
<Directory /usr/local/apache2/htdocs/somedir>
Options +ExecCGI
</Directory>

from: http://httpd.apache.org/docs/2.2/howto/cgi.html

do you really want to define it for the default-vhost (==all vhosts) or only for one special one? in the latter case it might be better to put it inside its own config-file in /etc/apache2/vhosts.d/.

Quote:
I think I have the module

have you compiled them with apache and have you loaded them (via /etc/conf.d/apache2 or httpd.conf?) fileperms correct on the cgi-file itself? (my cgis are all owned by apache himself)

GOOD LUCK!!
_________________
DUMM KLICKT GUT.
Back to top
View user's profile Send private message
rogerdv
Apprentice
Apprentice


Joined: 01 Apr 2006
Posts: 185
Location: Santiago, Cuba

PostPosted: Wed Aug 26, 2009 12:02 pm    Post subject: Reply with quote

Yes, i want it enabled for all vhosts.
Anyway, it doesnt works, apache keep saying that /cgi-bin/whatever does not exists.
_________________
Game programming news for newbies | The Ark, making an RPG the right way!
Back to top
View user's profile Send private message
DawgG
l33t
l33t


Joined: 17 Sep 2003
Posts: 866

PostPosted: Wed Aug 26, 2009 1:20 pm    Post subject: Reply with quote

Quote:
apache keep saying that /cgi-bin/whatever does not exists

well, does it? perms? can apache access it? logs? apache2 -S?

here is my config for the cgi-vhost (i have it all in the default-vhost, too) for a usemod-wiki:

Code:
 <VirtualHost *:80>
        ServerName stb-wiki.<SECRET>
        DocumentRoot "/var/www/localhost/wiki/"
        ScriptAlias /cgi-bin1/  /var/www/localhost/wiki/cgi-bin1/
        RedirectMatch .*/cgi-bin1$ https://tweety.<SECRET>/wikis/wiki.php
        RedirectMatch .*/cgi-bin1/$ https://tweety.<SECRET>/wikis/wiki.php
        RedirectMatch /$ https://tweety.<SECRET>/wikis/wiki.php
        RedirectMatch ^$ https://tweety.<SECRET>/wikis/wiki.php
        <Directory "/var/www/localhost/htdocs/wiki">
                Options ExecCGI Indexes
                AllowOverride None
                 Order allow,deny
                 Allow from all
        </Directory>
</VirtualHost>

(the redirs are for users just requesting the cgi-dir; they get redirected to a page with direct links to the cgi-files)

the whole thing was some pain to set up, since it's an (originally unplanned) additional vhost on a mission-critical ssl-server, but the apache-documentation was extremely helpful and now it works.

GOOD LUCK!
_________________
DUMM KLICKT GUT.
Back to top
View user's profile Send private message
rogerdv
Apprentice
Apprentice


Joined: 01 Apr 2006
Posts: 185
Location: Santiago, Cuba

PostPosted: Wed Aug 26, 2009 4:20 pm    Post subject: Reply with quote

Yes, the directory exists. When I place it into htdocs then the problem is different, instead of excuting it I got it as a regular file, I mean, the browser offers to save it. apache -S reports that the config is ok. I also changed the permissions, now the directory are owned by apache, with read and execute.
_________________
Game programming news for newbies | The Ark, making an RPG the right way!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum