samedi 10 octobre 2015

Python http server wont start on aws

I started a basic AWS instance (Amazon linux) and managed to SSH to it using putty. The public DNS was - ec2-(some_numbers).us-west-2.compute.amazonaws.com and I generated a key file and that worked for sshing and scping. Now, I want to be able to create web apps hosted on this server. I followed the instructions on the link - http://ift.tt/1OrndpN and ran the commands -

sudo yum groupinstall -y "Web Server" "PHP Support"
sudo service httpd start

At this point, they said I should have seen the apache test page when I type the public DNS in my browser, which I can. My ultimate aim is to have a python server that I have been developing on locally be hosted on this amazon linux instance. This I am unable to do. When I run my python file that contains the server and make it run on port 8888, I expect to be able to see the contents of my site when I type the (Public DNS):8888 in my browser. This doesn't seem to work. Does any one know what steps I need to take? My python code that starts the server -

from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

server_addr = ('', g_SERVING_PORT) 
server = HTTPServer(server_addr, MyHTTPHandler)  # MyHTTPHandler is my HTTP SERVER implementation
server.serve_forever()

On my local machine/network, I am able to run this python file on the console and see the served pages using the internal ip.




Aucun commentaire:

Enregistrer un commentaire