DEV Community

anitaalicloud
anitaalicloud

Posted on

Building and Deploying a Simple REST API on a Linux VPS with Nginx

Introduction

I recently built and deployed a simple REST API on a Linux server to strengthen my understanding of how backend services are hosted and managed in real world environments.

The goal was not to build a complex application, but to understand how an API runs in production from server setup to deployment and reverse proxy configuration.


What I Built

I created a lightweight REST API with three endpoints:

  • / → confirms the API is running
  • /health → checks service health
  • /me → returns basic profile information in JSON format

Each endpoint returns a JSON response and is optimized for fast response times.


Tech Stack

  • Node.js / Python (depending on your implementation)
  • Linux VPS (Ubuntu)
  • Nginx (reverse proxy)
  • PM2 / Systemd (process management)

How It Works

The application runs on a local server port and is not exposed directly to the internet.

Instead, Nginx handles incoming traffic and forwards it to the application.

Simple flow:

Client → Nginx → API Server (localhost)

This setup improves security, scalability, and control over traffic routing.


Deployment Approach

The process involved:

  • Setting up a Linux server environment
  • Running the API on a local port
  • Configuring Nginx as a reverse proxy
  • Using a process manager to keep the application running continuously

Once deployed, the API became publicly accessible through the server’s IP address or domain.


Key Learnings

This project helped me understand:

  • How APIs behave outside of local development
  • The role of reverse proxies in production systems
  • Why process managers are important for uptime
  • How Linux servers are used in real deployments

It was a simple project, but it gave me a clearer picture of how backend services are structured in real world systems.


Conclusion

Deploying this API helped bridge the gap between writing code and actually running it in a production like environment.

It reinforced the importance of understanding infrastructure, not just application logic.

Top comments (0)