简体   繁体   English

根域显示 nginx 默认欢迎页面,而子域 (www) 可以

[英]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.

相关问题 通过 www 访问。 将显示 Nginx 欢迎页面 [+ Gunicorn + Django] - Accessing via www. will show Nginx welcome page [+ Gunicorn + Django] Django + uwsgi + nginx重定向到默认页面“欢迎来到NGINX” - Django + uwsgi + nginx redirect to default page “Welcome to NGINX” 显示Nginx欢迎页面而不是登录页面 - Nginx welcome page showing up rather than the landing page nginx为域名提供服务欢迎页面,为IP提供我的网站 - nginx serve welcome page for domain and my site for ip django nginx gunicorn 应用程序显示 apache2 默认页面 - 仅针对 ip 请求而非域名 - django nginx gunicorn application showing apache2 default page - only on ip request not domain name 具有Nginx和Gunicorn的Django应用程序仅显示欢迎页面,其余所有页面均显示404错误 - Django application with nginx and gunicorn only showing welcome page rest all pages showing 404 error Letsencrypt SSL 在键入带有“www”的域时显示警告消息 - Letsencrypt SSL showing warning message while typing domain with "www" 显示默认的 nginx 页面而不是应用程序 - Showing default nginx page instead of application 将 server_name 从 IP 地址更改为域后,Nginx 仅显示欢迎页面 - Nginx shows only Welcome page after changing server_name from IP adress to domain Django Nginx无法正常显示默认页面 - Django Nginx not working properly showing default page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM