Skip to content

Add reverse proxy (nginx) section to HTTP deployment docs#3344

Merged
jlowin merged 3 commits intoPrefectHQ:mainfrom
dgenio:docs/reverse-proxy-nginx
Mar 2, 2026
Merged

Add reverse proxy (nginx) section to HTTP deployment docs#3344
jlowin merged 3 commits intoPrefectHQ:mainfrom
dgenio:docs/reverse-proxy-nginx

Conversation

@dgenio
Copy link
Copy Markdown
Contributor

@dgenio dgenio commented Mar 1, 2026

Description

Adds a "Reverse Proxy (nginx)" section to the HTTP deployment documentation, addressing the common question of how to deploy FastMCP behind nginx on Linux (closes #104).

The new section covers:

  • systemd service: a unit file for running FastMCP as a Linux background service
  • nginx configuration: complete config with SSE-specific settings (proxy_buffering off, long timeouts, proxy_http_version 1.1)
  • Key considerations: checklist of common pitfalls (buffering, timeouts, headers, TLS)
  • Path prefix mounting: nginx location block for subpath deployments

The section is placed between "Production Deployment" and "Testing Your Deployment" in the existing HTTP deployment page, which is the natural location for reverse proxy guidance that builds on the production setup.

# The existing ASGI app pattern works unchanged behind nginx:
from fastmcp import FastMCP

mcp = FastMCP("My Server")

@mcp.tool
def process_data(input: str) -> str:
    return f"Processed: {input}"

app = mcp.http_app()
# Run with: uvicorn app:app --host 127.0.0.1 --port 8000
# nginx proxies from https://mcp.example.com → http://127.0.0.1:8000

🤖 Generated with GitHub Copilot

Contributors Checklist

  • My change closes How to host in Linux server Via nginx? #104
  • I have followed the repository's development workflow
  • I have tested my changes manually and by adding relevant tests
  • I have performed all required documentation updates

Review Checklist

  • I have self-reviewed my changes
  • My Pull Request is ready for review

@marvin-context-protocol marvin-context-protocol Bot added documentation Updates to docs, examples, or guides. Primary change is documentation-related. http Related to HTTP transport, networking, or web server functionality. labels Mar 1, 2026
@dgenio dgenio marked this pull request as ready for review March 1, 2026 20:51
Copy link
Copy Markdown
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jlowin jlowin merged commit 8ad4eb8 into PrefectHQ:main Mar 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Updates to docs, examples, or guides. Primary change is documentation-related. http Related to HTTP transport, networking, or web server functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to host in Linux server Via nginx?

2 participants