Get the most out of your Centmin Mod LEMP stack
Become a Member

Install change the domain

Discussion in 'Install & Upgrades or Pre-Install Questions' started by dooma, Dec 8, 2016.

  1. dooma

    dooma Active Member

    Oct 15, 2016
    Local Time:
    8:35 PM

    I wanna change the domain of my website to avoid installing everything again ?, can I do that ?

  2. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    4:35 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x

    Changing Site's Domain Name

    Like http to https redirects you do one for switching domains. Example where is old domain and is new domain for site. You do a to redirect as outlined at How to Create NGINX Rewrite Rules | NGINX
    1. setup a new nginx vhost for new and DNS A record point to same server IP as
    2. grab your and/or nginx vhost and use their configs to replace contents of and vhost files replacing all instances of with in and vhost files
    3. then switch /home/nginx/domains/ name with /home/nginx/domains/ so rename /home/nginx/domains/ to /home/nginx/domains/ and rename /home/nginx/domains/ to /home/nginx/domains/
    4. at this stage accessing and should go to the same site/forums and work
    5. then in your and/or nginx vhost server{} contexts do a return 302 temp redirect to and check
      Code (Text):
       server {
          return 302 $scheme://$request_uri;
    6. So your and vhost files contents will look exactly like your previous working site's vhost files prior to move just with instead of referenced throughout and your newly updated and/or nginx vhost for old site now contain server{} context based return 302/301 redirects to
    7. Update your Google Analytics, Google/Bing Webmaster Tools accounts for site domain if applicable etc. Give it a few weeks to see and if all okay, change the return 302 to return 301 for permanent redirect