Going from a fresh Ubuntu install to a functioning django and wordpress site is pretty simple. I mostly borrowed the instructions from here.
Before you begin, you should go to your domain name provider and set an A (address) record for your domain name to your instance's IP address. If you don't have a domain name, buy one. Unless you have a really common name, or are building www.facebook.com, domain names are cheap and will only increase in demand in the future. I'm using example.com as the django site, and blog.example.com as the wordpress site.
Install dependencies. I use a standard apache/mysql/python stack:
sudo apt-get install apache2 libapache2-mod-wsgi python python-pip mysql-server python-mysqldb pip install django
Create your Django project somewhere:
cd /usr/local/src/ sudo django-admin.py startproject myproject
Next, create an apache config for your main site:
and put this in it:
<VirtualHost *:80> ServerName example.com WSGIScriptAlias / /var/www/apache/django.wsgi <Directory /var/www/apache> Order deny,allow Allow from all </Directory> </VirtualHost>
Create a wsgi file:
and put this in it:
import os, sys root = os.path.join(os.path.dirname(__file__), '/usr/local/src') sys.path.insert(0, root) sys.path.append('/var/www') sys.path.append('/usr/local/src/myproject') os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
Set some permissions:
chmod o+r /var/www/apache/django.wsgi chmod o+rx /var/www/apache chmod o+rx /usr/local/src
sudo /etc/init.d/apache2 reload sudo /etc/init.d/apache2 restart
Now, navigate to example.com. if everything went ok, you should see the Django success page. If not, check your apache logs and make sure your DNS records are correct and have propagated.
Next up is wordpress on a subdomain. Follow the directions here.
After that, we still need to configure apache for this site:
Put this in it:
<VirtualHost *:80> ServerName blog.example.com DocumentRoot /var/www/wordpress </VirtualHost>
Restart apache again. And that's it. Visit blog.example.com/wp-admin/install.php to set up wordpress. Make sure to set WordPress Address and Site Address (in settings) to blog.example.com, so your links are correct.