| Home » Categories » Multiple Categories |
How To Deploy Node.js Applications Using Systemd and Nginx |
|
Article Number: 274 | Rating: Unrated | Last Updated: Tue, Sep 23, 2025 at 11:04 PM
|
This tutorial uses a simple Node.js application, but is applicable to most, if not all, others as well (be they Ruby, Python, etc). For PHP web applications, it is recommended to use a more specialized LAMP or LEMP stack instead. Commands will be provided for both Fedora and Arch, do keep a lookout for which is which to avoid misconfiguration and/or confusion. When not indicated, the command is the same for both systems. It is also recommended you read through the entire tutorial before attempting it step-by-step, so as to get an idea of what it entails and whether it is appropriate for your situation. System Preliminaries—
Install packages—
Fedora:
Application Preliminaries— User—
Port— Application Setup— Using the system node—
Fedora:
Using a user-specific install—
Then take note of where the node binary is installed:
Deploy your application—
For this tutorial, the following sample application is used:
Then return to root:
Nginx Setup—
Then set up its daemon:
Systemd Setup— There's a few variables that need to be filled in:
Now start the service:
Usage— Status— systemctl status node-samplenode-sample.service Nov 22 01:12:15 d02 systemd[1]: Started node-sample.service. Logs— journalctl -u node-sample-- Logs begin at Thu 2013-11-21 19:05:17 UTC, end at Fri 2013-11-22 01:12:15 UTC. -- Restart, stop, etc—
Stop the application:
The application will be automatically restarted if it dies or is killed:
The PID has changed, showing the application has indeed been killed and restarted. Websockets—
and Nginx has to be reloaded:
|
Attachments
There are no attachments for this article.
|
How To Protect SSH with fail2ban on CentOS 6
Viewed 3120 times since Tue, Dec 31, 2013
How To Create An Off-Site Backup Of Your Site With Rsync On Centos 6
Viewed 6380 times since Sat, Jan 4, 2014
How To Install cPanel on a Virtual Server Running Centos 6
Viewed 3175 times since Thu, Jan 2, 2014
How To Install And Run A Node.js App On Centos 6.4 64bit
Viewed 10925 times since Sun, Dec 29, 2013
How To Install Node.js with NVM (Node Version Manager) on Server
Viewed 4340 times since Sun, Dec 29, 2013
How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 6
Viewed 6993 times since Thu, Dec 26, 2013
How To Get Started With mod_pagespeed with Apache on a CentOS and Fedora Cloud Server
Viewed 3473 times since Sat, Jan 4, 2014
How To Set Up an NFS Mount on CentOS 6
Viewed 9198 times since Tue, Dec 31, 2013
Docker Explained: How To Containerize and Use Nginx as a Proxy
Viewed 12464 times since Sat, Jan 4, 2014
How To Set Up Python 2.7.6 and 3.3.3 on CentOS 6.4
Viewed 7934 times since Sat, Jan 4, 2014
|
