[英]Root domain showing nginx default welcome page while subdomain (www) is ok
I am using django + nginx and so far I encounter this issue where if I go to www.stochie.com or the IP address it work fine while if i type in stochie.com it has some issue as in showing the nginx welcome or default page. I am using django + nginx and so far I encounter this issue where if I go to www.stochie.com or the IP address it work fine while if i type in stochie.com it has some issue as in showing the nginx welcome or default页。
here is my nginx config file:这是我的 nginx 配置文件:
server {
listen 80;
server_name www.stochie.com
stochie.com
""
18.139.57.168
;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/stochie;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
while in the django settings.py:而在 django settings.py 中:
ALLOWED_HOSTS = ['www.stochie.com', 'stochie.com', '18.139.57.168']
and in the google domain:在谷歌域中:
Hostname Type TTL Data
stochie.com A 1 hour 18.139.57.168
www.stochie.com CNAME 1 hour stochie.com.
After checking around, figure out it might be due to nginx using the default config instead of the stochie config but when it is not possible to modify and remove the default config due to permission issues.检查后发现这可能是由于 nginx 使用默认配置而不是 stochie 配置,但是由于权限问题无法修改和删除默认配置。 So currently not sure how to go about this:(
所以目前不确定如何 go 关于这个:(
I am not sure what is the solution but seem like after few hour (having lunch and going back home), now it is working... so weird我不确定解决方案是什么,但看起来像几个小时后(吃午饭回家),现在它正在工作......太奇怪了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.