By continuing to navigate on this website, you accept the use of cookies to serve you more relevant services & content.
For more information and to change the setting of cookies on your computer, please read our Cookie Policy.

Django Hosting on Amazon EC2 with wordpress on same domain

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.

    Posted On
  • 16 June 2013
  • By
  • Micropyramid

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
CORS with Amazon S3 and CloudFront

We struggle to load fonts from CloudFront because of CORS.

CORS - Cross Origin Resource Sharing is a security measure to block macious scripts or ...

Continue Reading...
Deploy Django using CloudFormation Template

CloudFormation helps in Using JSON templates to describe the resources needed from aws. With this approach, we don't have to repeat the same manual configuration ...

Continue Reading...
How to Mount S3 Bucket on Local Disk

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...
open source packages

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties