{"id":539,"date":"2015-09-01T11:26:58","date_gmt":"2015-09-01T11:26:58","guid":{"rendered":"http:\/\/hosting-marketers.com\/news\/?p=539"},"modified":"2015-09-01T14:55:30","modified_gmt":"2015-09-01T14:55:30","slug":"node-js-some-information","status":"publish","type":"post","link":"https:\/\/hosting-marketers.com\/news\/2015\/09\/01\/node-js-some-information\/","title":{"rendered":"Node.js some information"},"content":{"rendered":"<p>As third-party software, Hosting Marketers does not support node.js beyond installation.<br \/>\nAll our servers have node.js installed, but you need to configure it on your account, for that we need to know which port you using for the node, and you will need to create cron job and a bash file. The port we need to open it on our server firewall.<\/p>\n<p>Create a file for example server.js on your account. on this file enter the code:<\/p>\n<p>var http = require(&#8220;http&#8221;);<br \/>\nhttp.createServer(function(request, response) {<br \/>\nresponse.writeHead(200, {&#8220;Content-Type&#8221;: &#8220;text\/plain&#8221;});<br \/>\nresponse.write(&#8220;Hello World&#8221;);<br \/>\nresponse.end();<br \/>\n}).listen(5002);<\/p>\n<p>the number 5002 is your node port, open a ticket and explain that you going to use node and you want port 5002 opened.<\/p>\n<p><strong>Now in case this is your own vps or a dedicated server:<\/strong><br \/>\nthen create a file for example node.sh and on this file enter the below code:<\/p>\n<p>#!\/bin\/bash<br \/>\nPGREP=&#8221;\/usr\/bin\/pgrep&#8221;<br \/>\nNODE=&#8221;node&#8221;<br \/>\n$PGREP ${NODE}<br \/>\nif [ $? -ne 0 ]<br \/>\nthen<br \/>\n\/usr\/local\/bin\/node \/home\/cpanel-username\/public_html\/server.js> \/dev\/null 2>&#038;1<br \/>\nfi<\/p>\n<p>we are assuming your first file is server.js.<\/p>\n<p>Now create cron job for the node.sh, this file should be on 755 permissions.<br \/>\nthe cron can be:<\/p>\n<p>*\/10 * * * * sh \/home\/cpanel-username\/public_html\/node.sh >\/dev\/null 2>&#038;1<\/p>\n<p>this will mean the server will check every 10 minutes if the node is working and restart if it goes down.<\/p>\n<p>this can apply to any script which uses node.js<\/p>\n<p>then to test if the system is working call on your browser:<\/p>\n<p>http:\/\/domain:5002<br \/>\nthe page should load:<br \/>\nHello World<\/p>\n<p><strong>But if you are on a shared hosting:<\/strong><br \/>\nYou cannot use the node.sh option because when it pgrep it will find that there is other node process going on so it will not start yours. You will have to contact us so that we use the SCREEN option which will leave the process running on background even when we close the cmd window.<br \/>\nso we open cmd and type<br \/>\nscreen<br \/>\n\/usr\/local\/bin\/node \/home\/cpanel-username\/public_html\/server.js<br \/>\nCTRL D + A<br \/>\nthis will close the window and the process will continue, to test<br \/>\nhttp:\/\/domain:5002<br \/>\nthe page should load:<br \/>\nHello World<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>As third-party software, Hosting Marketers does not support node.js beyond installation. All our servers have node.js installed, but you need to configure it on your account, for that we need to know which port you using for the node, and you will need to create cron job and a bash file. The port we need [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[154],"class_list":["post-539","post","type-post","status-publish","format-standard","hentry","category-hosting-marketers-news","tag-node-js"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p9Yxzd-8H","jetpack-related-posts":[{"id":1141,"url":"https:\/\/hosting-marketers.com\/news\/2022\/08\/27\/node-js-creating-an-application-on-our-cpanel-application-manager\/","url_meta":{"origin":539,"position":0},"title":"Node JS: Creating an Application on our CPANEL Application Manager","author":"Admin","date":"August 27, 2022","format":false,"excerpt":"Creating an Application in the cPanel Application Manager Hosting applications with cPanel is a two-step process: Install the app on the server.\u00c2\u00a0Register it with\u00c2\u00a0the Application Manager. We\u00e2\u20ac\u2122ll look at registering an application in the next section, but first, we need to install it on the server. Users of the Git\u00e2\u201e\u00a2\u2026","rel":"","context":"In &quot;Hosting Marketers News&quot;","block_context":{"text":"Hosting Marketers News","link":"https:\/\/hosting-marketers.com\/news\/category\/hosting-marketers-news\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1050,"url":"https:\/\/hosting-marketers.com\/news\/2021\/06\/02\/deploy-node-js-on-our-shared-servers\/","url_meta":{"origin":539,"position":1},"title":"Deploy Node.js on our shared servers","author":"Admin","date":"June 2, 2021","format":false,"excerpt":"[et_pb_section][et_pb_row][et_pb_column type=\"4_4\"][et_pb_text] Version Control with Git Before we can\u00a0configure your Node.js application, the first step is getting that application on your server. There are a few options. You can use FTP to upload the copy of your application to your server, or you can use cPanel\u00e2\u20ac\u2122s native Git support to\u2026","rel":"","context":"In &quot;Hosting Marketers News&quot;","block_context":{"text":"Hosting Marketers News","link":"https:\/\/hosting-marketers.com\/news\/category\/hosting-marketers-news\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":801,"url":"https:\/\/hosting-marketers.com\/news\/2019\/07\/05\/how-to-deploy-an-app-nodejs-through-cpanel\/","url_meta":{"origin":539,"position":2},"title":"how to deploy an APP NodeJS Through cPanel","author":"Admin","date":"July 5, 2019","format":false,"excerpt":"how to setup or deploy an app on nodejs with our cpanel","rel":"","context":"In &quot;deploy app nodejs cpanel&quot;","block_context":{"text":"deploy app nodejs cpanel","link":"https:\/\/hosting-marketers.com\/news\/category\/deploy-app-nodejs-cpanel\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2019\/07\/node2.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2019\/07\/node2.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2019\/07\/node2.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":426,"url":"https:\/\/hosting-marketers.com\/news\/2013\/11\/15\/suphp-and-server-error\/","url_meta":{"origin":539,"position":3},"title":"suPHP and &#8220;Server Error&#8221;","author":"Admin","date":"November 15, 2013","format":false,"excerpt":"why you may get 500 Server Error on your site?","rel":"","context":"In &quot;security&quot;","block_context":{"text":"security","link":"https:\/\/hosting-marketers.com\/news\/category\/security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":86,"url":"https:\/\/hosting-marketers.com\/news\/2009\/01\/27\/ssh-connection\/","url_meta":{"origin":539,"position":4},"title":"Best way to connect to ssh","author":"Admin","date":"January 27, 2009","format":false,"excerpt":"Instead of using the cpanel ssh interface, do you have any software for ssh connections? If you dont then try to download bitvise tunnelier, and then connect to your account using the same username and password of your cpanel, of course you must first ask support to enable ssh on\u2026","rel":"","context":"In &quot;Hosting Marketers News&quot;","block_context":{"text":"Hosting Marketers News","link":"https:\/\/hosting-marketers.com\/news\/category\/hosting-marketers-news\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":107,"url":"https:\/\/hosting-marketers.com\/news\/2009\/09\/07\/dns-issue\/","url_meta":{"origin":539,"position":5},"title":"Why it takes so long to see my site using the domain? Is it a DNS propagation issue?","author":"Admin","date":"September 7, 2009","format":false,"excerpt":"You've registered your domain name, paid for hosting with a web hosting company, and started uploading your site to the server. If this is all done, why can't you see your site when you browse to your domain? What is this DNS propagation people keep telling you about? In order\u2026","rel":"","context":"In &quot;DNS propagation&quot;","block_context":{"text":"DNS propagation","link":"https:\/\/hosting-marketers.com\/news\/category\/dns-propagation\/"},"img":{"alt_text":"dns propagation","src":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2009\/09\/CMD03-300x176.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts\/539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/comments?post=539"}],"version-history":[{"count":3,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts\/539\/revisions"}],"predecessor-version":[{"id":542,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts\/539\/revisions\/542"}],"wp:attachment":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/media?parent=539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/categories?post=539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/tags?post=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}