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 21:39:34 CEST 2015


On Monday, September 21, 2015 at 9:20:22 PM UTC+2, sohca... at gmail.com wrote:
> On Monday, September 21, 2015 at 11:41:54 AM UTC-7, tropical... at gmail.com wrote:
> > 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.
> 
> "It isn't working" is about as useful as telling a mechanic "My car doesn't work" without giving details on what exactly is happening.
> 
> What exactly isn't working?  What error message are you getting?
> 
> The first thing I would check is to make sure the permissions on index.py are set to allow execution.  It is easy to forget to do that.

The error message that I am receiving in my browser is:
403: You don't have permission to access /index.py on this server.

The permissions of index.py is 755


More information about the Python-list mailing list