Want more timely Centmin Mod News Updates?
Become a Member

Problem with domain resolve

Discussion in 'Virtual Private Server (VPS) hosting' started by pamamolf, Jun 25, 2014.

  1. Andy

    Andy Active Member

    546
    90
    28
    Aug 6, 2014
    Ratings:
    +134
    Local Time:
    5:41 PM
    When I'm using spdycheck to check one of my domains
    SPDYCheck: Testing Websites for SPDY Support


    It reports that it still allow http access. I don't get it. If you use the browser to go to that domain using http, it will redirect to http but when I curl it, it doesn't show redirection
    Code:
    curl -I http://truongtot.vn
    HTTP/1.1 200 OK
    Server: nginx centminmod
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Vary: Accept-Encoding
    Date: Fri, 12 Dec 2014 23:44:56 GMT
    X-Page-Speed: 1.9.32.2-4321
    Cache-Control: max-age=0, no-cache
    this is my conf
    Code:
    # redirect from www to non-www
    # uncomment, save file and restart Nginx to enable
    server {
                listen 80;
                server_name www.truongtot.vn;
                return 301 https://truongtot.vn$request_uri;
           }
     
  2. eva2000

    eva2000 Administrator Staff Member

    59,284
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    8:41 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    you have a single nginx vhost .conf file for truongtot.vn ? what's it's full contents ? post in CODE tags

    edit: i see you accidentally set in step 1 of Getting started guide, the hostname of server to truongtot.vn which is same as your domain at http://truongtot.vn/ instead setting hostname to something like hostname.truongtot.vn
     
  3. Andy

    Andy Active Member

    546
    90
    28
    Aug 6, 2014
    Ratings:
    +134
    Local Time:
    5:41 PM
    Code:
    uname -n
    ryan.truongtot.vn
    I gotta admit it was bit confusing following your Getting started guide because you used alternatively between host and hostname and I don't know when I should do what. Your example used hostname as well instead of the real one you used on one of your domain.
    Content of my /etc/hosts
    Code:
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    128.199.140.175 ryan ryan.truongtot.vn
    2400:6180:0:d0::143:8001 ryan ryan.truongtot.vn
     
  4. Andy

    Andy Active Member

    546
    90
    28
    Aug 6, 2014
    Ratings:
    +134
    Local Time:
    5:41 PM
    Code:
    # redirect from www to non-www
    # uncomment, save file and restart Nginx to enable
    server {
      listen 80;
      server_name www.truongtot.vn;
      return 301 https://truongtot.vn$request_uri;
      }
    server {
      listen 443 ssl spdy;
      server_name truongtot.vn;
    
      ssl_certificate  /usr/local/nginx/conf/ssl/truongtot.vn/ssl-unified.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/truongtot.vn/ssl.key;
    
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_session_cache  shared:SSL:10m;
      ssl_session_timeout  10m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-$
      ssl_prefer_server_ciphers  on;
      add_header Alternate-Protocol  443:npn-spdy/3;
      add_header Strict-Transport-Security "max-age=31536000;";
    
      resolver 8.8.8.8;
      ssl_stapling on;
      ssl_stapling_verify on;
      ssl_trusted_certificate /usr/local/nginx/conf/ssl/truongtot.vn/ssl-trusted.crt;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/truongtot.vn/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/truongtot.vn/log/error.log;
    
    ## redirect www to no-www
      if ($host = 'www.truongtot.vn' ) {
      return 301 https://$server_name$request_uri;
      }
    root /home/nginx/domains/truongtot.vn/public;
    location /data {
      location ~ \.html$ {
      internal;
      }
      internal;
      }
    
      location /internal_data {
      location ~ \.(?:data|html|php)$ {
      internal;
      }
      internal;
      }
    
      location /library {
      location ~ \.(?:default|html|php|txt|xml)$ {
      internal;
      }
      internal;
      }
    
      location / {
      try_files $uri $uri/ /index.php?$uri&$args;
      index index.php;
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
    }
     
  5. eva2000

    eva2000 Administrator Staff Member

    59,284
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    8:41 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    I see what you mean, will fix that to use hostname as example.

    as to vhost you're missing the non-www in server_name at

    Code:
    server {
      listen 80;
      server_name truongtot.vn www.truongtot.vn;
      return 301 https://truongtot.vn$request_uri;
      }