Provisioning an ubuntu server for Django, Postgres, NGINX

February 27, 2017 | Posted in NGINX | None
  1. Install virtualenv

    sudo apt-get install python-pip
    sudo pip install virtualenv
  2. Install NGINX

    sudo apt-get install nginx
    sudo rm /etc/nginx/sites-available/default
    sudo rm /etc/nginx/sites-enabled/default
  3. Generate SSH public key

    cat .ssh/

Install and configure PostgreSQL

  1. Install Postgres

    sudo apt-get install postgresql
  2. Change postgres auth to trust.

    sudo nano /etc/postgresql/9.5/main/pg_hba.conf

    Modify this line

    local   all             postgres                                peer


    local   all             postgres                                trust

    Restart postgres

    sudo service postgresql restart
  3. Set password for user postgres

    psql -U postgres
    alter user postgres with password 's3cretPass';
  4. Change auth for postgres to md5

    sudo nano /etc/postgresql/9.5/main/pg_hba.conf


    local   all             postgres                                trust


    local   all             postgres                                md5
    sudo service postgresql restart

Configure extra packages

  1. Install libpq-dev (for psycopg2)
    sudo apt-get install libpq-dev

Related Posts

24 Jan 2017 » Stats from NGINX logs using Goaccess

16 Jul 2016 » Using Signals in Django

11 Jul 2016 » Installing PostgreSQL

25 Mar 2016 » Configuring SSH servers on Ubuntu

01 Sep 2015 » Redirecting with NGINX

01 May 2015 » Supervisor in Elastic Beanstalk

21 Apr 2015 » Uploading a file to Django

20 Apr 2015 » Postgres backup and recovery

02 Apr 2015 » PostgreSQL module ltree

25 Mar 2015 » Creating a blog with Django

14 Sep 2014 » Migrating databases with South

04 Sep 2014 » Forwarding port to a PostgreSQL server