Configuring NGINX

Create a new file inside the config/ directory and name it nginx.conf. Add the following code to it:

# the upstream component nginx needs to connect toupstream educa {    server unix:///tmp/educa.sock;}server {    listen      80;    server_name  www.educaproject.com educaproject.com;    location / {        include     /etc/nginx/uwsgi_params;        uwsgi_pass  educa;    }}

This is the basic configuration for NGINX. We set up an upstream named educa, which points to the socket created by uWSGI. We use the server directive and add the following configuration:

  • We tell NGINX to listen on port 80.
  • We set the server name to both www.educaproject.com and educaproject.com. NGINX will serve incoming requests for both domains.
  • We specify that everything under the / path ...

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.