Невозможно заставить NGINX, UWSGI, DJANGO работать на порту 80

Я следую этой инструкции по настройке Nginx --> uwsgi --> Django. Все отлично работает, когда серверный блок Nginx настроен на прослушивание порта 8000, но я не могу заставить его работать, когда порт установлен на 80. В итоге я получаю site unreachable.

Мой файл sites-enabled/conf имеет следующий вид:

# tracking_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    server unix:///home/dconran/django3/tracking/mainsite.sock; # for a file socket
    # server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8000;   #  <--- works
    # listen      80;   #  <---  doesn't work

    # the domain name it will serve for
    server_name corunna.com www.corunna.com; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    # location /media  {
    #     alias /path/to/your/mysite/media;  # your Django project's media files - amend as required
    # }

    location /static {
        alias /home/dconran/django3/tracking/tracker/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /home/dconran/django3/tracking/uwsgi_params; # the uwsgi_params file you installed
    }
}

Когда я пробую uwsgi --http :8000 --module mainsite.wsgi, это тоже работает, но uwsgi --http :80 --module mainsite.wsgi выдает следующую ошибку:

*** Starting uWSGI 2.0.29 (64bit) on [Mon Apr 14 15:58:21 2025] ***
compiled with version: 13.3.0 on 12 April 2025 17:42:47
os: Linux-6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025
nodename: ubuntu
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /home/dconran/django3/tracking
detected binary path: /home/dconran/django3/venv/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7283
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 769]

Я не знаю, какое разрешение запрещено, поскольку мое приложение mainsite.wsgi установлено на -rw-rw-r-- 1 dconran dconran 393 Mar 20 22:15 wsgi.py и dconran было добавлено в группу www-data.

Разрешение сокета установлено на srw-rw-rw- 1 dconran dconran 0 Apr 14 15:44 mainsite.sock

Что я делаю не так и как это исправить?

Вернуться на верх