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;


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: 79
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready