Django + Nginx configuration (getting “Welcome to nginx!”)
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
New contributor
add a comment |
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
New contributor
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
add a comment |
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
New contributor
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
django nginx
New contributor
New contributor
edited Jan 18 at 7:27
Андрій Шостацький
New contributor
asked Jan 17 at 21:45
Андрій ШостацькийАндрій Шостацький
11
11
New contributor
New contributor
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
Just disable default config:
rm /etc/nginx/sites-enabled/default
systemctl reload nginx
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Just disable default config:
rm /etc/nginx/sites-enabled/default
systemctl reload nginx
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
add a comment |
Just disable default config:
rm /etc/nginx/sites-enabled/default
systemctl reload nginx
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
add a comment |
Just disable default config:
rm /etc/nginx/sites-enabled/default
systemctl reload nginx
Just disable default config:
rm /etc/nginx/sites-enabled/default
systemctl reload nginx
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
add a comment |
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
add a comment |
Андрій Шостацький 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.
Андрій Шостацький 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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