nginx不带www可以正常访问,www域名不能正常访问
本文介绍了nginx不带www可以正常访问,www域名不能正常访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
一旦访问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;
}
}
解决方案
运营商进行的DNS跳转,最可能的原因就是域名没有解析,或者说是域名的解析结果还未生效。请检查域名解析的TTL,到网上查查当地的解析情况,试试清空本地的DNS缓存。
这篇关于nginx不带www可以正常访问,www域名不能正常访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文