nginx 不带 www 可以正常访问, www 域名不能正常访问

2016-06-30 14:00:10 +08:00
 MyFaith

一旦访问 www 域名就会跳转到 域名访问提示

域名已经解析 www 了,下面是nginx.conf

user              nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';    
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*.conf;
}

sites-enabled

server {
    listen 80;
    server_name www.youzisq.com youzisq.com;

    location / {
        proxy_pass http://127.0.0.1:5050;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
6146 次点击
所在节点    NGINX
9 条回复
alex321
2016-06-30 14:03:48 +08:00
首先检查 www 解析(或者解析生效)没呃。。。。
jswh
2016-06-30 14:04:48 +08:00
是不是 nginx 没 reload 配置
shulen
2016-06-30 14:09:46 +08:00
我觉得是域名解析不成功, nginx 配置是没有问题的
MyFaith
2016-06-30 14:16:20 +08:00
@alex321 解析应该是正常的,之前没用 nginx 的时候,加端口访问,是可以访问的,用了 nginx 之后,就这样了。
MyFaith
2016-06-30 14:16:28 +08:00
@MyFaith 解析应该是正常的,之前没用 nginx 的时候,加端口访问,是可以访问的,用了 nginx 之后,就这样了。
MyFaith
2016-06-30 14:17:01 +08:00
@jswh nginx -s reload 吗?执行过,还重启过。
MyFaith
2016-06-30 14:20:55 +08:00
@alex321
@jswh
@shulen
刚刚解决了,是 DNS 缓存。谢谢各位。
Leafove
2016-06-30 14:21:30 +08:00
表示可以访问 www 了
wingoo
2016-06-30 14:21:54 +08:00
dns 没生效吧
我这边 访问两个都是好的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/289327

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX