Setup Multiple Django Websites on Django One Click Install Image VPS

I have a Django One Click Install Image VPS on Ubuntu 14.04 and have a site running which has minimal traffic. I need to host another independent Django website on it. As I am new to webserver configuration. Could Someone please guide me through the NGINX and Gunicorn Upstart configuration to host multiple sites. Consider my Sites are: I have already referred the questions:

But it does not mention the NINX and Gunicorn configuration to serve 2 independent websites on the same server.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Refer to this article for the specifics on how the the Django one-click app is configured:

How To Use the Django One-Click Install Image

Copy the Nginx configuration for your new site:

cp /etc/nginx/sites-available/django /etc/nginx/sites-available/site2
ln -s /etc/nginx/sites-available/site2 /etc/nginx/sites-enabled/site2

Then edit its contents to match where you installed your new Django app:

upstream app_server {
    server fail_timeout=0;

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    client_max_body_size 4G;

    keepalive_timeout 5;

    # Your Django project's media files - amend as required
    location /media  {
        alias /home/django/new_project/new_app/media;

    # your Django project's static files - amend as required
    location /static {
        alias /home/django/new_project/new_app/static; 

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://app_server;

Do the same for the Upstart script used to start gunicorn:

cp /etc/init/gunicorn.conf /etc/init/new_site.conf

And change the port and path for the project:

description "Gunicorn daemon for Django project"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectedly trigger a respawn

setuid django
setgid django
chdir /home/django

exec gunicorn \
    --name=new_project \
    --pythonpath=new_project \
    --bind= \
    --config /etc/gunicorn.d/ \

You should now be able to start your project with:

service nginx restart
service new_site start

Notice that the way you start the project is determined by the name you give the Upstart script.

Hope this points you in the right direction! Let us know how it goes.

The one-click install for Ubuntu 16.04 is set-up a little differently. I do not see a gunicorn.conf file in etc/init directory and the app_server section of the settings file points to a gunicorn.socket file.

I’m lost. How do I setup multiple django sites using the Ubuntu 16 one-click install option?

This comment has been deleted