Skip to content Skip to sidebar Skip to footer

Setup Cgi-bin Server Python With Apache2.4.18

I have my index.py in /var/www/cgi-bin My index.py looks like this : #!/usr/bin/python print 'Content-type:text/html\r\n\r\n' print '' print '' print '<

Solution 1:

Try this :

Enable CGIa2enmod cgid

chmod a+x /var/www/cgi-bin/index.py but check cgi-bin directory owner is wwwdata ?

Need a directory definition on every Virtualhost !

Some time required restart for killing all apache threads !

   DocumentRoot /var/www/htdocs #A include B if owner are same !
   <Directory /var/www/htdocs/cgi-bin/ >
            FallbackResource /index.py
            Options +ExecCGI -MultiViews -SymLinksIfOwnerMatch -Indexes

            Order allow,deny
            Allow from all
            AddHandler cgi-script .py

    </Directory>

Solution 2:

use this file to run cgi script:

import cgi;
import cgitb;cgitb.enable()

Post a Comment for "Setup Cgi-bin Server Python With Apache2.4.18"