Django Hosting on Amazon EC2 with wordpress on same domain

Reading Time : ~ .

Configuring the Wordpress as subdirectory can be tricky. In this tutorial, we will Setup a Django Website alongside a WordPress blog. Our Site Structure will be

example.com ------------> Django Website
example.com/blog -----------> wordpress

Installing Prerequisites:

sudo apt-get install nginx python-dev python-pip python-virtualenv mysql-server nginx php5-fpm php5-mysql

Folder Structure:

/home/ubuntu/micropyramid
├── blog
│   ├── blog files
├── env
└── micropyramid_django
    └── django files

Nginx Configuration for Wordpress on Subdomain

server {
    listen 80 default_server;
    server_name example.com;

    location @wp {
      rewrite ^/blog(.*) /blog/index.php?q=$1;
    }

    location ^~ /blog {
        root /home/ubuntu/micropyramid;
        index index.php index.html index.htm;
        try_files $uri $uri/ @wp;

        location ~ \.php$ {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
           }
    }
}

You can follow this link for configuring Django Application on domain.  Now example.com should serve your django application and example.com/blog will serve your Wordpress Blog.

    By Posted On
SENIOR DEVELOPER at MICROPYRAMID

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
How to Mount S3 Bucket on Local Disk Dinesh Deshmukh

It all starts with FUSE, FUSE is File System User Space. Operating Systems have Kernel Space and User Space. Kernel Space is where low level ...

Continue Reading...
Deploying Django project on Elastic Beanstalk Shirisha Gaddi

Here You can learn about how to setup and deploy a Django application to Amazon Web Services (AWS).

Tools/technologies used:
Python v2.7
Django ...

Continue Reading...
Creating Elastic Search Cluster (EC2, cloud-aws Plugin) Jagadeesh V

While handling Large amounts of data with elasticsearch, you may run out of server capacity or compute power, Forming a Elasticsearch cluster will reduce the ...

Continue Reading...

Subscribe To our news letter

Subscribe to our news letter to receive latest blog posts into your inbox. Please fill your email address in the below form.
*We don't provide your email contact details to any third parties