【nginx】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】nginx不带www可以正常访问,www域名不能正常访问 的全部内容, 来源链接: utcz.com/a/83644.html