Home  >  Q&A  >  body text

nginx configures subdomain, but cannot access it

nginx configures the subdomain name, but still cannot access it. I don’t know if there is something wrong. Please help me~

server {
    listen 80;

    root /www/blog;
    index index.php index.html index.htm;
    
    server_name blog.xxx.com;
}
server {
    listen 443 ssl;

    root /www;
    index index.php index.html index.htm;

    server_name xxx.com ;

    error_page 404 = /404.html;

    
    #HTTPS

    #存放证书文件的位置
    ssl_certificate /etc/ssl/ssl.crt;
    ssl_certificate_key /etc/ssl/ssl.key;
}

#301 redirect
server {
    listen 80;
    server_name xxx.com;
    return 301 https://xxx.com$request_uri;
}

The naked domain made a welcome page and used SSL and 301 to jump to https. The root directory is /www
Then I want to set the blog domain name to a subdomain name, blog.xxx.com. The root directory of the blog is /www/blog
The configuration is as above. When you visit xxx.com/blog normally, the blog will appear, but when you visit blog.xxx.com, you will jump directly to the 114 navigation...


The DNS hijacking has been fixed, but it is still inaccessible. Chrome displays "This webpage is not available"

PHPzPHPz2713 days ago496

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 17:20:42

    Add location configuration

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 17:20:42

    It seems that the situation of jumping to 114 navigation is usually caused by DNS resolution error or DNS hijacking

    reply
    0
  • ringa_lee

    ringa_lee2017-05-16 17:20:42

    It is recommended to grab the package and see if it jumps to your server

    reply
    0
  • Cancelreply