Join the community today
Register Now

Domains want domain to respond to www. and ww2. - easy?

Discussion in 'Domains, DNS, Email & SSL Certificates' started by Derek, Aug 5, 2016.

  1. Derek

    Derek New Member

    28
    9
    3
    Aug 5, 2016
    Ratings:
    +16
    Local Time:
    2:07 AM
    So I've done a test migration of vBulletin to Xenforo, using centminmod as the target platform (Centos 7, but it seems to work great). I'm convinced that the migration went well, but I'd like others to check it out as well before we wipe the slate and perform the migration for real.

    What I'd like to do is tell centminmod to proxy connections to ww2.mysite.com to the existing www. installation transparently, but that's probably expecting too much. The next best thing would probably be to tell centminmod that connections to ww2 should map to the existing install, and I'll make the required changes with DNS and Xenforo to make the site reply appropriately.

    What's the official way to do this? I learned back in HSphere days that blindly editing config files that were controlled by a master script was a solid way to screw things up, or at the very least cause confusion down the road when the master script rewrite files because it wasn't aware of the changes.

    Thanks!
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,914
    6,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,405
    Local Time:
    5:07 PM
    Nginx 1.13.x
    MariaDB 5.5
    You basically want to park a domain on top of another or a domain alias where www and ww2 both resolve and point to the same site and site web root ?
    For that there's a nice thread at Domains - Usage of a Short Domain | Centmin Mod Community

    You basically edit the domain's nginx vhost domain.com.conf file and/or domain.com.ssl.conf if it exists and edit the server_name listing so if abc.com was real live site and xyz.com is the domain your want to park on top of abc.com as domain alias, it would be
    Code (Text):
    server {
    server_name abc.com xyz.com;

    If you need www too it would be
    Code (Text):
    server {
    server_name abc.com www.abc.com xyz.com www.xyz.com;

    Then to ensure your SEO isn't messed up setup canonical link headers in nginx vhost file too as outlined here. You need to set it up in 2 places.

    In nginx vhost file itself i.e. abc.com.conf or domain.com.conf and if applicable abc.com.ssl.conf or domain.com.ssl.conf
    Code (Text):
    add_header Link "<http://abc.com$request_uri>; rel=\"canonical\"";
    

    and in /usr/local/nginx/conf/staticfiles.conf include file which is included in each nginx vhost file. Add header canonical link to the html location context
    Code (Text):
        location ~* \.(html|htm|txt)$ {
      add_header Link "<http://abc.com$request_uri>; rel=\"canonical\"";
      #add_header Pragma public;
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 1d;
        break;
            }
    

    This is so that html based files also serve the correct canonical link header to tell search engines which is the real domain so that search engines do not see it as duplicate content.

    Then restart Nginx and PHP-FPM at same time using Centmin Mod command shortcuts outlined in FAQ item 15
    Code (Text):
    nprestart
    

    To confirm just run curl command in SSH against your domain i.e. curl headers and grep filter for word canonical
    Code (Text):
    curl -sI https://abc.com | grep canonical
    

    output would be something like
    Code (Text):
    curl -sI https://abc.com | grep canonical
    Link: <http://abc.com/>; rel="canonical"
    
     
  3. Derek

    Derek New Member

    28
    9
    3
    Aug 5, 2016
    Ratings:
    +16
    Local Time:
    2:07 AM
    Thanks for the detailed reply! I performed the first part intuitively and have it connected; I'll perform the rest this afternoon.

    I appreciate the prompt reply. :)
     
    • Like Like x 1
  4. eva2000

    eva2000 Administrator Staff Member

    30,914
    6,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,405
    Local Time:
    5:07 PM
    Nginx 1.13.x
    MariaDB 5.5