It takes a few commands to get mod_python with Apache up and running on the free tier Amazon Linux AMI of EC2.
Step 1
Install Apache and mod_python using
1
| |
Step 2
Add python handlers by adding the following lines to /etc/httpd/conf.d/python.conf
1 2 3 4 5 6 7 8 9 10 11 | |
Step 3
Add a script to serve by creating a file /var/www/html/my.py and add the following code to it:
1 2 | |
Access the file using http://my-ec2-address/my.py (make sure port 80 is open on the EC2-firewall)