Home  >  Q&A  >  body text

nginx can be accessed normally without www, but the www domain name cannot be accessed normally

Once you access the www domain name, you will jump to Domain name access prompt

The domain name has resolved www, the following is 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;
    }
}
PHP中文网PHP中文网2713 days ago571

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 17:17:57

    The most likely reason for the DNS jump performed by the operator is that the domain name has not been resolved, or the resolution result of the domain name has not yet taken effect. Please check the TTL of domain name resolution, check the local resolution online, and try clearing the local DNS cache.

    reply
    0
  • Cancelreply