Loading ...
Sorry, an error occurred while loading the content.

CGI/Apache

Expand Messages
  • Noamn
    Does anyone have any experience with writing CGI scripts for Apache? I ve just installed Apache on my not connected to the Internet but connected to LAN Linux
    Message 1 of 2 , Aug 5, 2002
    • 0 Attachment
      Does anyone have any experience with writing CGI scripts for Apache? I've
      just installed Apache on my not connected to the Internet but connected to
      LAN Linux box, and whilst I can access html files from other computers on
      the LAN, I can't get even the simplest CGI script to work.

      The base directory for html files is /var/www/html, and apparently the base
      directory for cgi files is /var/www/cgi-bin, but if I try to access a cgi
      (ie perl) file from there, IE wants to download the file! The perl file's
      permissions are 755.

      I know that once I get this sorted out, things should be much easier, but
      it's the first step that is the hardest.

      TIA,
      No'am
    • Tzafrir Cohen
      ... Note that the DocumentRoot (the root directory of documents displayed by the web server) is (I guess) /var/www/html . So the scripts in /var/www/cgi-bin
      Message 2 of 2 , Aug 5, 2002
      • 0 Attachment
        On Mon, 5 Aug 2002, Noamn wrote:

        > Does anyone have any experience with writing CGI scripts for Apache? I've
        > just installed Apache on my not connected to the Internet but connected to
        > LAN Linux box, and whilst I can access html files from other computers on
        > the LAN, I can't get even the simplest CGI script to work.
        >
        > The base directory for html files is /var/www/html, and apparently the base
        > directory for cgi files is /var/www/cgi-bin, but if I try to access a cgi
        > (ie perl) file from there, IE wants to download the file! The perl file's
        > permissions are 755.
        >
        > I know that once I get this sorted out, things should be much easier, but
        > it's the first step that is the hardest.

        Note that the DocumentRoot (the "root directory" of documents displayed by
        the web server) is (I guess) /var/www/html . So the scripts in
        /var/www/cgi-bin are not directly accessible from the outside.

        Exposing such a directory of script is usually done through ScriptAlias :

        The following is a quote of a default configuration from a relatively old
        version of apache. It will make /cgi-bin and /protected-cgi-bin . The
        latter only accessible from localhost, and thus you can put there scripts
        that you want to test, but are not yet sure you want to expose to the
        outside world.


        # ScriptAlias: This controls which directories contain server scripts.
        # Format: ScriptAlias fakename realname

        ScriptAlias /cgi-bin/ /var/httpd/cgi-bin/
        ScriptAlias /protected-cgi-bin/ /var/httpd/protected-cgi-bin/

        # /home/httpd/cgi-bin should be changed to whatever your ScriptAliased
        # CGI directory exists, if you have that configured.

        #
        # Later on in httpd.conf...
        #


        <Directory /var/httpd/cgi-bin>
        AllowOverride None
        Options ExecCGI
        </Directory>

        <Directory /var/httpd/protected-cgi-bin>
        order deny,allow
        deny from all
        allow from localhost
        #allow from .your_domain.com
        AllowOverride None
        Options ExecCGI
        </Directory>


        --
        Tzafrir Cohen /"\
        mailto:tzafrir@... \ / ASCII Ribbon Campaign
        Taub 229, 972-4-829-3942, X Against HTML Mail
        http://www.technion.ac.il/~tzafrir / \
      Your message has been successfully submitted and would be delivered to recipients shortly.