Question

After following this tutorial to setup an EC2 instance for a Django app, I can't connect to the application. Any help debugging, would be greatly appreciated.

Steps followed after setting up EC2 instance:

  1. sudo aptitude install python-django
  2. sudo aptitude install mysql-server
  3. sudo aptitude install python-mysqldb
  4. sudo aptitude install libapache2-mod-wsgi
  5. mkdir srv
  6. cd srv
  7. django-admin startproject mysite
  8. sudo vim /etc/apache2/sites-available/mysite.com

    NameVirtualHost *:80
    
    <VirtualHost *:80>
    
        ServerName mysite.com
        ServerAlias www.mysite.com
        WSGIScriptAlias / /home/demo/public_html/mysite.com/mysite.wsgi
    </VirtualHost>
    
  9. sudo vim /home/demo/public_html/mysite.com/mysite.wsgi

    import os
    import sys
    
    sys.path.append('/home/demo/public_html/mysite.com/')
    
    os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
    
    import django.core.handlers.wsgi
    
    application = django.core.handlers.wsgi.WSGIHandler()
    
  10. sudo a2ensite mysite.com

  11. sudo /etc/init.d/apache2 reload

For my host records on my URL:

    @  to the Private IP from Amazon as an A Record
    www to the Private IP from Amazon as an A record

The result is that when I enter the IP address, myurl.com, and www.myurl.com all are unable to connect to the server.

Any ideas on how to debug this?

Was it helpful?

Solution

Don't use the private IP for your instance, that's only useful if you're accessing your instance from within EC2, instead use the public IP in your hosts file.

OTHER TIPS

You should use an elastic IP attached to the instance for a static, public IP address. You then place this in your host file. These are free as long as you have them attached to an active instance. If you terminate or stop the instance, you will be billed for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top