Welcome! Log In Create A New Profile

Advanced

Nginx/Django/uwsgi point to domain

Posted by sajmoon 
Nginx/Django/uwsgi point to domain
October 07, 2021 06:17PM
Hi guys.
I've got an django app which runs on nginx and uwsgi.I recently purchased domain and im having difficulties with setting it up...When i enter domain in browser site loads but it changes back to ip...

Nginx config:

# GNU nano 4.8
upstream django {
server unix:/home/cvc/webserver/www/UselessIdea/ui.sock;

}




server {

listen 80;

server_name www.somedomain.org somedomain.org;

charset utf-8;


client_max_body_size 75M;



location /media {
alias /home/cvc/webserver/www/UselessIdea/media;
}

location /static {
alias /home/cvc/webserver/www/UselessIdea/static;
}


location / {

proxy_set_header X-Forwarded-Proto http;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
uwsgi_pass django;

return 301 http://$server_name;

include /home/cvc/webserver/www/UselessIdea/uwsgi_params.txt;
}
}



If I use "return 301 http://$server_name;" I get too many redirects error
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready