How to Deploy a NodeJs Server Using Laravel Forge

How to Deploy a NodeJs Server Using Laravel Forge

Hi, I’m Valerio, software engineer from Italy, and C.T.O. at Inspector.

Hi, I’m Valerio, a software engineer from Italy, and C.T.O. at Inspector.

We recently worked to replace the HTTP handler behind our ingestion endpoint (ingestion.inspector.dev) with a new implementation in pure NodeJs. This endpoint receives monitoring data sent from all applications connected to our Code Execution Monitoring engine, and it treats more than 5 million HTTP requests per day. Using Nodejs we are seeing a 5x performance improvement in managing this large volume of traffic making Inspector more reliable and fast.

In this article, I’ll show you how to deploy a NodeJs server using Forge, the most popular server management tool in the Laravel community. Forge was primarily designed to deploy PHP apps, but it’s simple enough to get a node application running because it includes a set of services like NGINX and SupervisorD that can greatly simplify the server configuration.

NGINX configuration

We just need to take advantage of Nginx's excellent built-in proxy capabilities.

Suppose to have a NodeJs server running on port 3000:

// Start web server
http.createServer((req, res) => {

    // Managing the incoming http request

}).listen(3000, () => {
    console.log("Server is listening on port: 3000")
});

We need to tell Nginx that inbound requests should be proxied to the node process running our application on port 3000.

At the bottom of the site details section in your Forge server, you’ll find the “Files” button to access the site’s NGINX configuration file. The section that we’re interested in is the “location_” block that begins with “/”. For a standard PHP or Laravel site, the default setting of _try_files works well.

inspector expressjs laravel nodejs

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Php how to delete multiple rows through checkbox using ajax in laravel

In this article i will let you know to delete multiple rows through checkbox using ajax in laravel and before delete we will give a confirmation message.

Top Laravel Development Company India | Laravel Development Services

As a Laravel development company, we use this framework to deliver robust & scalable customized Laravel web solutions & enterprise portals to global clients. 4200+ Projects | 16+ Yrs Exp | 97% Customer Retention

Hire Laravel Developers | Laravel Development Company, Services India

Hire Laravel developers & dedicated programmers in India for custom Laravel development services on an hourly / full-time basis. 16+ years exp & 4200+ projects | Strict NDA | Contact Us Today

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

Laravel App Development Company in India, Hire Laravel Developers

IndianAppDevelopers, leading Laravel app development company in India, Hire Laravel app developers or programmers from India at cost effective price.