{"id":18418,"date":"2015-03-22T19:39:53","date_gmt":"2015-03-22T14:09:53","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=18418"},"modified":"2017-01-02T10:48:46","modified_gmt":"2017-01-02T05:18:46","slug":"php-to-node-js-migration-retaining-your-cpanel-e-mail-account-while-dns-migration","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/php-to-node-js-migration-retaining-your-cpanel-e-mail-account-while-dns-migration\/","title":{"rendered":"PHP to Node.JS Migration &#8211; Retaining Your Cpanel E-Mail Account While DNS Migration"},"content":{"rendered":"<div>Hello folks,<\/div>\n<div><\/div>\n<div>If you are here on this blog, you might be searching for the ways to migrate your existing PHP website to <a title=\"Node.js development\" href=\"http:\/\/www.tothenew.com\/mean-node-js-development-consulting\">Node.js<\/a>.<\/div>\n<div><\/div>\n<div>In this blog i will try to explain, how you can point your existing domain to nodejs hosting and keep using the cpanel hosting for managing emails for your domain.<\/p>\n<\/div>\n<div>To start with, you will have to make sure of the following things:<\/p>\n<\/div>\n<ol>\n<li>You have an existing linux cpanel hosting (shared\/dedicated).<\/li>\n<li>You have hosted your nodejs application on some other hosting provider such as heroku\/clever-cloud.<\/li>\n<li>You want the contents should be served from the nodejs hosting.<\/li>\n<li>You want the email accounts which you have been using should work as it is.<\/li>\n<li>You have an existing domain name registered say via Godaddy, example:<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<\/li>\n<li>Your nodejs application has a domain say<span class=\"Apple-converted-space\">\u00a0<\/span>mynodewebsite.herokuapp.com<\/li>\n<li>Your Name Server for<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>points to your existing cpanel hosting say<span class=\"Apple-converted-space\">\u00a0<\/span>ns1.cpanelhosting.com<\/li>\n<\/ol>\n<div>So now you want that<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>should point to heroku server i.e.<span class=\"Apple-converted-space\">\u00a0<\/span>mynodewebsite.herokuapp.com<\/div>\n<p>Work to be done:<\/p>\n<ol>\n<li>Add your domain name in the alias of your project in nodejs hosting , i.e. add<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>as alias in your heroku account for the<span class=\"Apple-converted-space\">\u00a0<\/span>mynodewebsite.herokuapp.com<\/li>\n<li>The DNS of<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>will have to be changed from your cpanel hosting (not from your domain registrar eg: godaddy)<\/li>\n<\/ol>\n<div>Steps to follow:<\/div>\n<p>For the first part i.e. adding custom domain to your nodejs app, steps are really easy.<\/p>\n<p>For Heroku hosting:<\/p>\n<ol>\n<li>Goto your dashboard.<\/li>\n<li>Click on the application which you want to add custom domain.<\/li>\n<li>Click on settings on top right.<\/li>\n<li>Scroll down a bit, Click on Edit in the Custom Domain.<\/li>\n<li>Add both<span class=\"Apple-converted-space\">\u00a0<\/span>mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>and<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>over there<\/li>\n<li>Click on Save, Thats It!<\/li>\n<\/ol>\n<div>For the Second Part which is a little tricky but still easy to do.<\/div>\n<p>What do you need for this?<\/p>\n<ol>\n<li>The ip address of the nodejs hosting website on which it resides.<\/li>\n<li>Your main domain name.<\/li>\n<\/ol>\n<p>To get the ip address of your nodejs hosting, try to ping it from your console\/command prompt.<\/p>\n<p>Alternatively you can take the help of websites which would give you the ip address of any website, for eg\u00a0https:\/\/www.site24x7.com\/find-ip-address-of-web-site.html<\/p>\n<p>Just put in the url of your nodejs app url say\u00a0mynodewebsite.herokuapp.com\u00a0and it will show you the ip address of it. Copy that ip address to clipboard!<\/p>\n<p>Steps to change your current DNS for main domain:<\/p>\n<ol>\n<li>Log into your Cpanel hosting, usually via<span class=\"Apple-converted-space\">\u00a0<\/span>cpanel.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>by providing login credentials.<\/li>\n<li>Scroll down till you find heading as DOMAINS.<\/li>\n<li>Click on Advance DNS Zone Editor.<\/li>\n<li>Select the domain name from the drop down over there.<\/li>\n<li>Scroll down to the Zone File Records.<\/li>\n<li>Now you have to change 2 things over here, the Type A record and the cname record for your main domain.<\/li>\n<li>Click on edit in the row where its shows your main domain eg:<span class=\"Apple-converted-space\">\u00a0<\/span>mydomainname.com.<\/li>\n<li>You will have to change the ip address listed over there with the one which you just copied for your nodejs hosting.<\/li>\n<li>Save the record and scroll down where it says<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>.<\/li>\n<li>You will have to change it CNAME for this record from<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>to<span class=\"Apple-converted-space\">\u00a0<\/span>mynodewebsite.herokuapp.com<\/li>\n<\/ol>\n<div>Tada!!! you are done.<\/p>\n<\/div>\n<div>Now whenever you will open<span class=\"Apple-converted-space\">\u00a0<\/span>www.mydomainname.com<span class=\"Apple-converted-space\">\u00a0<\/span>it will point to your herokuapp hosting and the fun part is that your email\/ftp account for your existing cpanel will not get affected from this migration \ud83d\ude42<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello folks, If you are here on this blog, you might be searching for the ways to migrate your existing PHP website to Node.js. In this blog i will try to explain, how you can point your existing domain to nodejs hosting and keep using the cpanel hosting for managing emails for your domain. To [&hellip;]<\/p>\n","protected":false},"author":177,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0},"categories":[1185,1],"tags":[1704,1702,596,1224,260,1703,1124,1701],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18418"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/177"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=18418"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18418\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=18418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=18418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=18418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}