Django + Nginx configuration (getting “Welcome to nginx!”)












0















I have Django + Nginx + Gunicorn on Ubuntu. Certificates generated with Letsencrypt.



In /etc/nginx/sites-available/myproject I have:



server {
server_name myproject.com www.myproject.com;
listen 80;
return 301 https://myproject.com$request_uri;
}

server {
server_name myproject.com www.myproject.com;

listen 443;

ssl on;
ssl_certificate /etc/letsencrypt/live/myproject.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myproject.com/privkey.pem;

client_max_body_size 1G;

root /home/myname/myproject;

location / {
include proxy_params;
proxy_pass https://unix:/home/myname/myproject/myproject.sock;
}
}


In /etc/nginx/sites-available/default, except commented lines, I have:



server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
try_files $uri $uri/ =404;
}
}


In /etc/nginx/sites-enabled I have default and myproject.



When I go to https://myproject.com, I see "Welcome to nginx!", but I expect to see Django's default page.
What am I doing wrong that it redirects to "Welcome to nginx!"?










share|improve this question









New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • What site are you expecting to see?

    – Kingsley
    Jan 17 at 23:22











  • Whenever nginx is configured it always show its welcome page. What side do you want to see? For detailed step-by-step tutorial to successfully deploy django app with gunicorn + nginx you check this link- digitalocean.com/community/tutorials/…

    – Reema Parakh
    Jan 18 at 5:42











  • I expect to see Django's default page. I followed that tutorial and it worked fine with http, but after using lets encrypt for some reason it started to redirect to nginx default page.

    – Андрій Шостацький
    Jan 18 at 7:24


















0















I have Django + Nginx + Gunicorn on Ubuntu. Certificates generated with Letsencrypt.



In /etc/nginx/sites-available/myproject I have:



server {
server_name myproject.com www.myproject.com;
listen 80;
return 301 https://myproject.com$request_uri;
}

server {
server_name myproject.com www.myproject.com;

listen 443;

ssl on;
ssl_certificate /etc/letsencrypt/live/myproject.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myproject.com/privkey.pem;

client_max_body_size 1G;

root /home/myname/myproject;

location / {
include proxy_params;
proxy_pass https://unix:/home/myname/myproject/myproject.sock;
}
}


In /etc/nginx/sites-available/default, except commented lines, I have:



server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
try_files $uri $uri/ =404;
}
}


In /etc/nginx/sites-enabled I have default and myproject.



When I go to https://myproject.com, I see "Welcome to nginx!", but I expect to see Django's default page.
What am I doing wrong that it redirects to "Welcome to nginx!"?










share|improve this question









New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • What site are you expecting to see?

    – Kingsley
    Jan 17 at 23:22











  • Whenever nginx is configured it always show its welcome page. What side do you want to see? For detailed step-by-step tutorial to successfully deploy django app with gunicorn + nginx you check this link- digitalocean.com/community/tutorials/…

    – Reema Parakh
    Jan 18 at 5:42











  • I expect to see Django's default page. I followed that tutorial and it worked fine with http, but after using lets encrypt for some reason it started to redirect to nginx default page.

    – Андрій Шостацький
    Jan 18 at 7:24
















0












0








0








I have Django + Nginx + Gunicorn on Ubuntu. Certificates generated with Letsencrypt.



In /etc/nginx/sites-available/myproject I have:



server {
server_name myproject.com www.myproject.com;
listen 80;
return 301 https://myproject.com$request_uri;
}

server {
server_name myproject.com www.myproject.com;

listen 443;

ssl on;
ssl_certificate /etc/letsencrypt/live/myproject.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myproject.com/privkey.pem;

client_max_body_size 1G;

root /home/myname/myproject;

location / {
include proxy_params;
proxy_pass https://unix:/home/myname/myproject/myproject.sock;
}
}


In /etc/nginx/sites-available/default, except commented lines, I have:



server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
try_files $uri $uri/ =404;
}
}


In /etc/nginx/sites-enabled I have default and myproject.



When I go to https://myproject.com, I see "Welcome to nginx!", but I expect to see Django's default page.
What am I doing wrong that it redirects to "Welcome to nginx!"?










share|improve this question









New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have Django + Nginx + Gunicorn on Ubuntu. Certificates generated with Letsencrypt.



In /etc/nginx/sites-available/myproject I have:



server {
server_name myproject.com www.myproject.com;
listen 80;
return 301 https://myproject.com$request_uri;
}

server {
server_name myproject.com www.myproject.com;

listen 443;

ssl on;
ssl_certificate /etc/letsencrypt/live/myproject.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myproject.com/privkey.pem;

client_max_body_size 1G;

root /home/myname/myproject;

location / {
include proxy_params;
proxy_pass https://unix:/home/myname/myproject/myproject.sock;
}
}


In /etc/nginx/sites-available/default, except commented lines, I have:



server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
try_files $uri $uri/ =404;
}
}


In /etc/nginx/sites-enabled I have default and myproject.



When I go to https://myproject.com, I see "Welcome to nginx!", but I expect to see Django's default page.
What am I doing wrong that it redirects to "Welcome to nginx!"?







django nginx






share|improve this question









New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Jan 18 at 7:27







Андрій Шостацький













New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Jan 17 at 21:45









Андрій ШостацькийАндрій Шостацький

11




11




New contributor




Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Андрій Шостацький is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • What site are you expecting to see?

    – Kingsley
    Jan 17 at 23:22











  • Whenever nginx is configured it always show its welcome page. What side do you want to see? For detailed step-by-step tutorial to successfully deploy django app with gunicorn + nginx you check this link- digitalocean.com/community/tutorials/…

    – Reema Parakh
    Jan 18 at 5:42











  • I expect to see Django's default page. I followed that tutorial and it worked fine with http, but after using lets encrypt for some reason it started to redirect to nginx default page.

    – Андрій Шостацький
    Jan 18 at 7:24





















  • What site are you expecting to see?

    – Kingsley
    Jan 17 at 23:22











  • Whenever nginx is configured it always show its welcome page. What side do you want to see? For detailed step-by-step tutorial to successfully deploy django app with gunicorn + nginx you check this link- digitalocean.com/community/tutorials/…

    – Reema Parakh
    Jan 18 at 5:42











  • I expect to see Django's default page. I followed that tutorial and it worked fine with http, but after using lets encrypt for some reason it started to redirect to nginx default page.

    – Андрій Шостацький
    Jan 18 at 7:24



















What site are you expecting to see?

– Kingsley
Jan 17 at 23:22





What site are you expecting to see?

– Kingsley
Jan 17 at 23:22













Whenever nginx is configured it always show its welcome page. What side do you want to see? For detailed step-by-step tutorial to successfully deploy django app with gunicorn + nginx you check this link- digitalocean.com/community/tutorials/…

– Reema Parakh
Jan 18 at 5:42





Whenever nginx is configured it always show its welcome page. What side do you want to see? For detailed step-by-step tutorial to successfully deploy django app with gunicorn + nginx you check this link- digitalocean.com/community/tutorials/…

– Reema Parakh
Jan 18 at 5:42













I expect to see Django's default page. I followed that tutorial and it worked fine with http, but after using lets encrypt for some reason it started to redirect to nginx default page.

– Андрій Шостацький
Jan 18 at 7:24







I expect to see Django's default page. I followed that tutorial and it worked fine with http, but after using lets encrypt for some reason it started to redirect to nginx default page.

– Андрій Шостацький
Jan 18 at 7:24














1 Answer
1






active

oldest

votes


















0














Just disable default config:



rm /etc/nginx/sites-enabled/default
systemctl reload nginx





share|improve this answer
























  • Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

    – Андрій Шостацький
    Jan 18 at 17:09













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Андрій Шостацький is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54244753%2fdjango-nginx-configuration-getting-welcome-to-nginx%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Just disable default config:



rm /etc/nginx/sites-enabled/default
systemctl reload nginx





share|improve this answer
























  • Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

    – Андрій Шостацький
    Jan 18 at 17:09


















0














Just disable default config:



rm /etc/nginx/sites-enabled/default
systemctl reload nginx





share|improve this answer
























  • Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

    – Андрій Шостацький
    Jan 18 at 17:09
















0












0








0







Just disable default config:



rm /etc/nginx/sites-enabled/default
systemctl reload nginx





share|improve this answer













Just disable default config:



rm /etc/nginx/sites-enabled/default
systemctl reload nginx






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 18 at 12:29









QtebQteb

8010




8010













  • Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

    – Андрій Шостацький
    Jan 18 at 17:09





















  • Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

    – Андрій Шостацький
    Jan 18 at 17:09



















Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

– Андрій Шостацький
Jan 18 at 17:09







Thxs! Disabled default. After that I got 502 error. When changed proxy_pass from https to http, it worked fine.

– Андрій Шостацький
Jan 18 at 17:09












Андрій Шостацький is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Андрій Шостацький is a new contributor. Be nice, and check out our Code of Conduct.













Андрій Шостацький is a new contributor. Be nice, and check out our Code of Conduct.












Андрій Шостацький is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54244753%2fdjango-nginx-configuration-getting-welcome-to-nginx%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage