Error while running django react app

im getting this error :

2025/02/08 06:52:00 [crit] 51556#51556: *388 connect() to unix:///home/django/web/web.com/private/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xxxx, server: web.com, request: “GET / HTTP/2.0”, upstream: “uwsgi://unix:///home/django/web/web.com/private/uwsgi.sock:”, host: “web.com

then i run this


sudo chown www-data:www-data /home/django/web/web.com/private/uwsgi.sock

sudo chmod 660 /home/django/web/web.com/private/uwsgi.sock

i want to know is this the correct way to give Permission ? the apps work fine after that

here is my template files /usr/local/hestia/data/templates/web/nginx/

app.stpl

server {
    listen      %ip%:%proxy_ssl_port% ssl;
    server_name %domain_idn% %alias_idn%;
    error_log   /var/log/%web_system%/domains/%domain%.error.log error;

    ssl_certificate     %ssl_pem%;
    ssl_certificate_key %ssl_key%;
    ssl_stapling        on;
    ssl_stapling_verify on;

    # TLS 1.3 0-RTT anti-replay
    if ($anti_replay = 307) { return 307 https://$host$request_uri; }
    if ($anti_replay = 425) { return 425; }

    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    # Deny access to hidden files except for well-known
    location ~ /\.(?!well-known\/|file) {
        deny all;
        return 404;
    }

    # Proxy uwsgi requests
    location / {
        include uwsgi_params;
        uwsgi_pass unix:///home/django/web/web.com/private/uwsgi.sock;  # Update this to match your uwsgi socket path
    }

    # Serve static files
    location /static/ {
        alias /home/django/web/web.com/private/django-react-app/backend/static/;
    }

    location /error/ {
        alias %home%/%user%/web/%domain%/document_errors/;
    }

    proxy_hide_header Upgrade;
    include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

app.tpl


server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    error_log   /var/log/%web_system%/domains/%domain%.error.log error;

    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    # Deny access to hidden files except for well-known
    location ~ /\.(?!well-known\/|file) {
        deny all;
        return 404;
    }

    # Proxy uwsgi requests
    location / {
        include uwsgi_params;
        uwsgi_pass unix:///home/django/web/web.com/private/uwsgi.sock;  # Update this to match your uwsgi socket path
    }

    # Serve static files
    location /static/ {
        alias /home/django/web/web.com/private/django-react-app/backend/static/;
    }

    location @fallback {
        proxy_pass http://%ip%:%web_port%;
    }

    location /error/ {
        alias %home%/%user%/web/%domain%/document_errors/;
    }

    include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}