Nginx local setup

📰 Dev.to · Željko Šević

Learn to set up Nginx locally for reverse proxying and web serving, and discover how to configure it for various development needs.

intermediate Published 20 Jun 2026
Action Steps
  1. Install Nginx on your local machine using apt or brew
  2. Configure Nginx to sit on port 80 and route traffic to apps running on other ports
  3. Set up reverse proxying to forward requests to specific applications or services
  4. Configure path-based routes to direct traffic to different applications or services based on URL paths
  5. Serve static files using Nginx and configure it to handle different file types
Who Needs to Know This

This tutorial is beneficial for developers, DevOps engineers, and anyone who wants to set up a local development environment with Nginx. It provides a step-by-step guide on how to install, configure, and use Nginx for reverse proxying, routing traffic, and serving static files.

Key Insight

💡 Nginx can be used as a reverse proxy and web server on a local machine, allowing for flexible routing and serving of applications and static files.

Share This
🚀 Set up Nginx locally for reverse proxying, web serving, and more! 💻

Key Takeaways

Learn to set up Nginx locally for reverse proxying and web serving, and discover how to configure it for various development needs.

Full Article

Title: Nginx local setup

URL Source: https://dev.to/zsevic/nginx-local-setup-4idd

Published Time: 2026-06-20T20:46:54Z

Markdown Content:
# Nginx local setup - DEV Community
[Skip to content](https://dev.to/zsevic/nginx-local-setup-4idd#main-content)

[![Image 1: DEV Community](https://media2.dev.to/dynamic/image/quality=100/https://dev-to-uploads.s3.amazonaws.com/uploads/logos/resized_logo_UQww2soKuUsjaOGNB38o.png)](https://dev.to/)

[Powered by Algolia](https://www.algolia.com/developers/?utm_source=devto&utm_medium=referral)

[Log in](https://dev.to/enter?signup_subforem=1)[Create account](https://dev.to/enter?signup_subforem=1&state=new-user)

## DEV Community

![Image 2](https://assets.dev.to/assets/heart-plus-active-9ea3b22f2bc311281db911d416166c5f430636e76b15cd5df6b3b841d830eefa.svg)0 Add reaction

![Image 3](https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg)0 Like ![Image 4](https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg)0 Unicorn ![Image 5](https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg)0 Exploding Head ![Image 6](https://assets.dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg)0 Raised Hands ![Image 7](https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg)0 Fire

0 Jump to Comments 0 Save Boost

Copy link

Copied to Clipboard

[Share to X](https://twitter.com/intent/tweet?text=%22Nginx%20local%20setup%22%20by%20%40sevicdev%20%23DEVCommunity%20https%3A%2F%2Fdev.to%2Fzsevic%2Fnginx-local-setup-4idd)[Share to LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fdev.to%2Fzsevic%2Fnginx-local-setup-4idd&title=Nginx%20local%20setup&summary=Nginx%20is%20a%20reverse%20proxy%20and%20web%20server.%20On%20a%20local%20machine%20it%20can%20sit%20on%20port%2080%20and%20route%20traffic...&source=DEV%20Community)[Share to Facebook](https://www.facebook.com/sharer.php?u=https%3A%2F%2Fdev.to%2Fzsevic%2Fnginx-local-setup-4idd)[Share to Mastodon](https://s2f.kytta.dev/?text=https%3A%2F%2Fdev.to%2Fzsevic%2Fnginx-local-setup-4idd)

[Share Post via...](https://dev.to/zsevic/nginx-local-setup-4idd#)[Report Abuse](https://dev.to/report-abuse)

[![Image 8: Cover image for Nginx local setup](https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flci9vvwj853l8ahrspmq.png)](https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flci9vvwj853l8ahrspmq.png)

[![Image 9: Željko Šević](https://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F329310%2F1134d19a-755a-427e-b2f4-fb9d4166b783.png)](https://dev.to/zsevic)

[Željko Šević](https://dev.to/zsevic)
Posted on Jun 20 • Originally published at [sevic.dev](https://sevic.dev/notes/nginx-local-setup/)

# Nginx local setup

[#nginx](https://dev.to/t/nginx)[#devops](https://dev.to/t/devops)[#wsl](https://dev.to/t/wsl)

Nginx is a reverse proxy and web server. On a local machine it can sit on port 80 and route traffic to apps running on other ports - a frontend on `:3000`, an API on `:4000`, or a Docker Compose stack with published ports.

This post covers install, config layout, reverse proxying, path-based routes, static files, and service commands on a local dev machine. It does not cover HTTPS, production hardening, or multi-domain TLS.

On Windows, use WSL2 with Ubuntu. On macOS or Linux, the same `apt` or `brew` install steps apply.

### [](https://dev.to/zsevic/nginx-local-setup-4idd#prerequisites) Prerequisites

* WSL2 with Ubuntu (W
Read full article → ← Back to Reads