{"id":27446,"date":"2020-05-23T15:52:07","date_gmt":"2020-05-23T20:52:07","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=27446"},"modified":"2023-04-04T09:32:13","modified_gmt":"2023-04-04T14:32:13","slug":"set-up-a-node-js-application-for-production-on-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/","title":{"rendered":"How To Set Up a Node.js Application for Production on Ubuntu 16.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p>We all know that Node.js is a JavaScript platform used for general-purpose programming which allows users to build network applications fast. The development will be more consistent and designed within the system by leveraging JavaScript on both the front- and back-end.<\/p>\n<p>Here, we will guide you on how to get started with Node.js on an Ubuntu 16.04 server.<\/p>\n<p><!--more--><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69fd0a8b8ec06\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69fd0a8b8ec06\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#Install-Nodejs\" >Install Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#Create-Nodejs-Application\" >Create Node.js Application<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#PM2\" >PM2<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Install-Nodejs\"><\/span><strong><b>Install Node.js<\/b><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>As the first step, we are going to install the latest version of Node.js, and that will be done using the NodeSource package archives.<\/p>\n<pre>$ cd ~\r\n$ curl -sL https:\/\/deb.nodesource.com\/setup_10.x <span class=\"pl-k\">|<\/span> sudo -E bash -<\/pre>\n<pre>$ sudo apt-get update\r\n$ sudo apt-get install nodejs<\/pre>\n<p>The <code>nodejs<\/code> package contains both the <code>nodejs<\/code> binary and <code>npm<\/code>, so there is no need to install <code>npm<\/code> separately. But please have in mind that in order for some <code>npm<\/code> packages to work (for example those that require compiling code from source), you will have to install the <code>build-essential<\/code> package:<\/p>\n<pre>sudo apt-get install build-essential<\/pre>\n<p>At this point the Node.js runtime is installed and at the same time prepared to run an application! Let&#8217;s write a node.js application.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Create-Nodejs-Application\"><\/span>Create Node.js Application<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>For now all we write is a <em>Hello World<\/em> application that simply returns &#8220;Hello World&#8221; to any HTTP requests. This sample application will allow you to get your Node.js set up, which can be replaced with different application &#8211; but you need to be sure that your application has been modified to listen on the appropriate IP addresses and ports.<\/p>\n<h3>Hello World Code<\/h3>\n<p>The first thing you need to do is to create and open your Node.js application for editing. Here we are using <code>nano<\/code> in order to edit a sample application called <code>hello.js<\/code>:<\/p>\n<pre>cd ~\r\nnano hello.js\r\n<\/pre>\n<p>This following code should be inserted into the file. You can also replace the highlighted port, <code><span class=\"highlight\">8080<\/span><\/code>, in both locations (don`t forget that you should use a non-admin port, i.e. 1024 or greater):<\/p>\n<pre>#!\/usr\/bin\/env nodejs\r\nvar http = require('http');\r\nhttp.createServer(function (req, res) {\r\n  res.writeHead(200, {'Content-Type': 'text\/plain'});\r\n  res.end('Hello World\\n');\r\n}).listen(8080, 'localhost');\r\nconsole.log('Server running at http:\/\/localhost:8080\/');<\/pre>\n<p>Next save and exit.<\/p>\n<p>The Node.js application listens to the specified address (<code>localhost<\/code>) and port (<code>8080<\/code>), and returns &#8220;Hello World&#8221; with a <code>200<\/code> HTTP success code.The remote clients will not have the chance to connect to your application because we are listening on <strong>localhost. <\/strong><\/p>\n<h3>Test Application<\/h3>\n<p>If you want to test your application, mark <code>hello.js<\/code> executable:<\/p>\n<pre>chmod +x .\/hello.js<\/pre>\n<p>And then run it like this:<\/p>\n<pre>.\/hello.js<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"PM2\"><\/span><strong><b>PM2<\/b><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>PM2, which has a built-in load balancer, is a production process manager for Node.js applications. Thanks to the PM2 the applications are kept alive forever, it also reloads them without downtime and makes the common system admin tasks easier. There are several steps on how to install the PM2. You can see them below.<\/p>\n<p><strong>Install PM2<\/strong><\/p>\n<p>We are going to use Node Packaged Modules (NPM), that it is a package manager for Node modules which installs with Node.js,in order to install PM2 on the app server. If you want to install PM2 use this following command:<\/p>\n<pre>$ sudo npm install pm2 -g<\/pre>\n<p>It is quite easy and simple to use Manage Application with PM2. Here only a couple of basic PM2 uses are covered.<\/p>\n<p><strong>Start Application<\/strong><\/p>\n<p>Using the PM2 start command to run your application hello.js, in the background is the first thing you should do:<\/p>\n<pre>$ pm2 start hello.js<\/pre>\n<p>This will add your application to PM2\u2019s process list, which is outputted every time you start an application:<\/p>\n<p><img decoding=\"async\" class=\"alignleft wp-image-27447 size-full\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png\" alt=\"\" width=\"759\" height=\"72\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png 759w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello-150x14.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello-300x28.png 300w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/p>\n<h3><\/h3>\n<h3><\/h3>\n<h3><strong>Install and Configure Nginx as the Reverse Proxy Server<\/strong><\/h3>\n<p>Next step is installing Nginx as the reverse proxy server for MEAN app. For installation type this command.<\/p>\n<pre><code>sudo apt-get install nginx<\/code><\/pre>\n<p>you can also redirect all request to MEAN app, open and edit Nginx configuration file.<\/p>\n<pre>sudo nano \/etc\/nginx\/sites-available\/default<\/pre>\n<p>Use this if you want to replace location body.<\/p>\n<pre>server_name your_domain.com;\r\n\r\nlocation \/ {\r\n    proxy_pass http:\/\/localhost:8080;\r\n    proxy_http_version 1.1;\r\n    proxy_set_header Upgrade $http_upgrade;\r\n    proxy_set_header Connection 'upgrade';\r\n    proxy_set_header Host $host;\r\n    proxy_cache_bypass $http_upgrade;\r\n}<\/pre>\n<p>Press CTRL+O in order to save it then press CTRL+X to exit the Nano editor. Type the following command if you want to test Nginx configuration.<\/p>\n<pre>sudo nginx -t<\/pre>\n<p>You can restart your Nginx server when you see the response below.<\/p>\n<pre>nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/pre>\n<p>If you decide to restart Nginx type this command.<\/p>\n<pre>sudo service nginx restart<\/pre>\n<p>Of course you don\u2019t have to set up a Node.js application for production on Ubuntu 16.04, if you use one of our Blazing-Fast <a href=\"https:\/\/www.rosehosting.com\/managed-vps-hosting.html\" target=\"_blank\" rel=\"noopener noreferrer\">SSD VPS Hosting services<\/a>, in which case you can simply ask our expert Linux admins to install Node.js on Ubuntu 16.0, for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>PS.<\/strong><\/span> If you liked this post on how to set up a Node.js application for production on Ubuntu 16.04, and create your first Express application, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We all know that Node.js is a JavaScript platform used for general-purpose programming which allows users to build network applications &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How To Set Up a Node.js Application for Production on Ubuntu 16.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#more-27446\" aria-label=\"Read more about How To Set Up a Node.js Application for Production on Ubuntu 16.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1698],"tags":[357,239],"class_list":["post-27446","post","type-post","status-publish","format-standard","hentry","category-tutorials","category-ubuntu","tag-node-js","tag-nodejs","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How To Set Up a Node.js Application for Production on Ubuntu 16.04 | RoseHosting<\/title>\n<meta name=\"description\" content=\"Quick guide on how to set up a Node.js application for production on Ubuntu 16.04. Learning doesn&#039;t need to be comlicated.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Set Up a Node.js Application for Production on Ubuntu 16.04\" \/>\n<meta property=\"og:description\" content=\"How To Set Up a Node.js Application for Production on Ubuntu 16.04 | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-23T20:52:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-04T14:32:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How To Set Up a Node.js Application for Production on Ubuntu 16.04\",\"datePublished\":\"2020-05-23T20:52:07+00:00\",\"dateModified\":\"2023-04-04T14:32:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/\"},\"wordCount\":730,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/hello.png\",\"keywords\":[\"node.js\",\"nodejs\"],\"articleSection\":[\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/\",\"name\":\"How To Set Up a Node.js Application for Production on Ubuntu 16.04 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/hello.png\",\"datePublished\":\"2020-05-23T20:52:07+00:00\",\"dateModified\":\"2023-04-04T14:32:13+00:00\",\"description\":\"Quick guide on how to set up a Node.js application for production on Ubuntu 16.04. Learning doesn't need to be comlicated.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/hello.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/hello.png\",\"width\":759,\"height\":72},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Set Up a Node.js Application for Production on Ubuntu 16.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Set Up a Node.js Application for Production on Ubuntu 16.04 | RoseHosting","description":"Quick guide on how to set up a Node.js application for production on Ubuntu 16.04. Learning doesn't need to be comlicated.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/","og_locale":"en_US","og_type":"article","og_title":"How To Set Up a Node.js Application for Production on Ubuntu 16.04","og_description":"How To Set Up a Node.js Application for Production on Ubuntu 16.04 | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2020-05-23T20:52:07+00:00","article_modified_time":"2023-04-04T14:32:13+00:00","og_image":[{"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png","type":"","width":"","height":""}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How To Set Up a Node.js Application for Production on Ubuntu 16.04","datePublished":"2020-05-23T20:52:07+00:00","dateModified":"2023-04-04T14:32:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/"},"wordCount":730,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png","keywords":["node.js","nodejs"],"articleSection":["Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/","url":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/","name":"How To Set Up a Node.js Application for Production on Ubuntu 16.04 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png","datePublished":"2020-05-23T20:52:07+00:00","dateModified":"2023-04-04T14:32:13+00:00","description":"Quick guide on how to set up a Node.js application for production on Ubuntu 16.04. Learning doesn't need to be comlicated.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/07\/hello.png","width":759,"height":72},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-a-node-js-application-for-production-on-ubuntu-16-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Set Up a Node.js Application for Production on Ubuntu 16.04"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/27446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=27446"}],"version-history":[{"count":6,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/27446\/revisions"}],"predecessor-version":[{"id":45298,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/27446\/revisions\/45298"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=27446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=27446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=27446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}