Skip to content
Greg Bowler edited this page May 11, 2026 · 9 revisions

The web server has two jobs in a WebEngine project:

  • serve real static files from www/
  • pass dynamic page requests into WebEngine

Getting that split right is one of the most important parts of a deployment.

Local server vs. production server

For local development, PHP's built-in server is often enough, and gt serve or gt run handles the setup for you.

For production, use a real web server such as Nginx or Apache. Those are designed to serve static files efficiently, route PHP requests properly, and scale far beyond what the built-in server can do.

Key setup concepts

The main concepts are:

  • document root should point at www/
  • dynamic requests need a fallback route into WebEngine's go.php
  • static assets should be served directly where possible
  • PHP execution needs to be configured correctly for your chosen server

The exact syntax depends on the server, but the model stays the same.

Scaling

PHP's development server is for development only. It is not designed to scale in production.

By contrast, a normal server-rendered, hypermedia-first WebEngine application can take full advantage of ordinary web server scaling strategies. Vertical scaling means giving one server more resources. Horizontal scaling means spreading requests across more than one server. Which matters depends on the application, but neither strategy works well unless the basic document root and request routing are set up correctly first.


For database-driven applications it's important to get the database setup correct and secure.

Clone this wiki locally