---
title: "Deploy nginx-modsecurity-waf"
description: "Deploy and Host nginx-modsecurity-waf with Railway"
category: "Other"
url: https://railway.com/deploy/nginx-modsecurity-waf
---

# Deploy nginx-modsecurity-waf

Deploy and Host nginx-modsecurity-waf with Railway

**[Deploy nginx-modsecurity-waf on Railway](https://railway.com/template/nginx-modsecurity-waf)**

- **Creator:** Breno A.'s Projects
- **Category:** Other
- **Total deploys:** 2

## Template content

### coreruleset/modsecurity-crs

- **Image:** ghcr.io/coreruleset/modsecurity-crs:nginx-alpine
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host nginx-modsecurity-waf on Railway

nginx-modsecurity-waf is a lightweight security reverse proxy built with Nginx, ModSecurity 3, and the OWASP Core Rule Set. It filters and blocks common web attacks before they reach your backend.

## About Hosting nginx-modsecurity-waf

Deploying nginx-modsecurity-waf means running an Nginx reverse proxy with ModSecurity enabled and CRS rules loaded. The WAF inspects every request and only forwards clean traffic to your backend. On Railway it listens on port 8080 and connects to your app using the BACKEND environment variable. Railway handles networking, scaling, and SSL termination so you get a fully managed WAF with minimal setup.

## Common Use Cases

* Protecting APIs and web apps from common attacks
* Securing legacy apps without modifying the code
* Adding a filtering layer in front of microservices

## Dependencies for nginx-modsecurity-waf Hosting

* A reachable backend service
* DNS resolvers for outbound traffic

### Deployment Dependencies

* [https://coreruleset.org](https://coreruleset.org)
* [https://github.com/owasp-modsecurity/ModSecurity/wiki](https://github.com/owasp-modsecurity/ModSecurity/wiki)

### Implementation Details

Example environment variables:

```
PORT=8080
BACKEND=http://backend:8080
BLOCKING_PARANOIA=1
DETECTION_PARANOIA=1
MODSEC_AUDIT_ENGINE=RelevantOnly
MODSEC_AUDIT_LOG=/dev/stdout
ALLOWED_METHODS=GET HEAD POST OPTIONS
ALLOWED_REQUEST_CONTENT_TYPE="|application/json|"
RESOLVERS="8.8.8.8 1.1.1.1"
SSL_ENGINE=off
NGINX_ALWAYS_TLS_REDIRECT=off
```

Health check path: `/healthz`

## Why Deploy nginx-modsecurity-waf on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you do not have to deal with configuration while allowing you to vertically and horizontally scale it.

By deploying nginx-modsecurity-waf on Railway, you are one step closer to supporting a complete full stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/nginx-modsecurity-waf
