{"id":2717,"date":"2018-06-18T20:36:13","date_gmt":"2018-06-19T03:36:13","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=2717"},"modified":"2018-06-18T20:37:08","modified_gmt":"2018-06-19T03:37:08","slug":"migrating-to-a-new-server","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=2717","title":{"rendered":"Notes on testing domains while migrating to a new server."},"content":{"rendered":"<p>When moving sites to a new server, you can test each one by replacing the DocumentRoot in the 000-default.conf file with the   directory containing each site. You might want to do some site tweaking and changing the location for each site can get tedious after a while. The solution is to set up Apache to test virtual servers without domain names. The first step is to edit the \/etc\/hosts file on the computer that you will be using to visit the sites. Add the sites you wish to test and the IP address at the end of the file.<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\n142.255.228.33 firstsitetotest.com\n142.255.228.33 secondsitetotest.com\n...\n142.255.228.33 lastsitetotest.com\n<\/code><\/pre><\/p>\n<p>You don\u2019t need to reboot your computer or reload the file to get it to work.<\/p>\n<p>Next, edit the <em>000-default.conf<\/em> file in <em>\/etc\/apache2\/sites-available\/<\/em><br \/>\nI keep my site files in the <em>\/www<\/em> directory.<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\n &lt;VirtualHost firstsitetotest.com:80&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;ServerName www. firstsitetotest.com\n&nbsp;&nbsp;&nbsp;&nbsp;DocumentRoot \/www\/firstsitetotest\n\n &lt;\/VirtualHost&gt;\n\n&lt;VirtualHost secondsitetotest.com:80&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;ServerName www.secondsitetotest.com\n&nbsp;&nbsp;&nbsp;&nbsp;DocumentRoot \/www\/secondsitetotest\n\n &lt;\/VirtualHost&gt;\n...\n &lt;VirtualHost lastsitetotest.com:80&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;ServerName www. lastsitetotest.com\n&nbsp;&nbsp;&nbsp;&nbsp;DocumentRoot \/www\/lastsitetotest\n\n &lt;\/VirtualHost&gt;\n\n<\/code><\/pre><\/p>\n<p>Reload Apache with  <em>sudo systemctl reload apache2<\/em> and test your config with  <em>sudo systemctl status apache2<\/em><\/p>\n<p>If the sites currently exist, you should make a small change in the main file to make sure you are being redirected to the new site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When moving sites to a new server, you can test each one by replacing the DocumentRoot in the 000-default.conf file with the directory containing each site. You might want to do some site tweaking and changing the location for each site can get tedious after a while. The solution is to set up Apache to &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=2717\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Notes on testing domains while migrating to a new server.<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-2717","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2717"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2717\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}