Using regular expressions within Nginx we can bind urls to particular application servers, below we will configure wordpress blog and django site to be deployed on same domain name with each having their respective application servers i.e. ‘fastcgi’ for wordpress and ‘uwsgi’ for django.
Consider the following basic configuration:
Django site is running using uwsgi app server, so django_site.sock is created at /home/ directory. When we hit djangoproject.com/foo then nginx looks for location block matching ‘foo’ string and serves the request with uwsgi.
So by replacing ‘foo’ with ‘blog’ and uwsgi server with fastcgi, nginx serves wordpress blog.
Django project directory: /home/micropyramid/micropyramid
Uwsgi sock file location: /home/micropyramid/mp.sock
Wordpress project directory: /var/www/html
Fastcgi sock file location: /var/run/php5-fpm.sock
When the url contains the format ‘micropyramid.com/blog’ nginx matches location with /blog regex and uses fastcgi to serve wordpress blog, on all other cases django site will be served.
Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.
Django-CRM :Customer relationship management based on Django
Django-blog-it : django blog with complete customization and ready to use with one click installer Edit
Django-webpacker : A django compressor tool
Django-MFA : Multi Factor Authentication
Docker-box : Web Interface to manage full blown docker containers and imagesMore...