Knowledgebase

Handling Traffic with a Reverse Proxy Print

  • vpsservermanagement, caching, ssl, php, security, htaccess, performance, guide
  • 0

Nginx in front of an application server.

WHAT IT DOES

Receives requests, serves static files directly, and forwards dynamic requests to the application behind it.

WHY IT HELPS

Static files are served efficiently without involving the application Connections are handled cheaply, so slow clients do not tie up application processes Caching can be applied at the proxy SSL termination happens in one place Multiple applications can sit behind one entry point

TYPICAL ARRANGEMENTS

Nginx in front of Apache, combining Nginx efficiency with .htaccess support Nginx in front of a Node.js or Python application Nginx in front of PHP-FPM directly

CONFIGURATION POINTS

Pass the real visitor address through, or your application logs show only the proxy Pass the protocol through, or the application may not know the request was secure Set sensible timeouts Configure caching deliberately, excluding anything user-specific

THE TRADE-OFF

More components to configure and maintain. Worth it for sites with meaningful traffic; unnecessary complexity for a small site.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot