Problem configuring apache to run python cgi on Ubuntu 14.04

tropical.dude.net at gmail.com tropical.dude.net at gmail.com
Mon Sep 21 20:41:13 CEST 2015


Hello everybody,

I installed the LAMP stack on in Ubuntu, but I am having
problems configuring Apache to run python CGI scripts.

I ran:
sudo a2enmod cgi

I added to apache2.conf
<Directory /srv/www/yoursite/public_html>
        Options +ExecCGI
        AddHandler cgi-script .py
</Directory>

I created index.py:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-# enable debugging
import cgitb

cgitb.enable()    
print("Content-Type: text/html;charset=utf-8")
print("Hello World!")

But it is still not working.

Can anybody help me out?

Thanks in advance.


More information about the Python-list mailing list