Nginx and Gunicorn Configuration

Installation

  • Ensure that both Gunicorn and Nginx are installed on your server.

Gunicorn Configuration

  • Run Gunicorn pointing to your project's WSGI file:
gunicorn --bind 0.0.0.0:8000 nombre_del_proyecto.wsgi:application

Nginx Configuration

  • Create a server block in the Nginx configuration:
server {
    listen 80;
    server_name tudominio.com www.tudominio.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /ruta/a/tu/proyecto;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/ruta/a/tu/proyecto/nombre_del_proyecto.sock;
    }
}
  • Make sure to create a symbolic link in sites-enabled and restart Nginx to apply the changes.