Settings that allow Apache to execute CGI with document rooting

It is a description of the setting that enables CGI to be executed by document rooting in Apache of Ubuntu.

Even if you do enable mod_cgid to use CGI in Apache settings of Ubuntu, "/ usr / lib / cgi-bin /" You can only run CGI with:

This is secure, but many CGI applications that have already been created will be required to run under the document root.

When doing Web system development with Perl newly, security, development efficiency, real-time Web, cloud server, etc. are comprehensively integrated. Considering this, we recommend reverse proxy operation.

Apache config file for running CGI under the document root

Apache's configuration file for running CGI under the document root. It is supposed to operate in default virtual host.

The default virtual host needs to be loaded first, so it needs to be the file name to be loaded first, such as "000-default.conf", prefixed with "000". be careful.

<VirtualHost *: 80>
  ServerName www.mydomain.example

  DocumentRoot "/ var / www / html"

  AddHandler cgi-script .cgi

  <Directory / var / www / html>
    Options + ExecCGI
  </Directory>
</VirtualHost>

Operate with HTTPS

If you want to operate the CGI program with HTTPS, the following article explains how to set the SSL certificate.

Run a CGI program in user Perl

If you want to run the program in user Perl instead of system Perl, please refer to the following articles.

Associated Information