-
-
Notifications
You must be signed in to change notification settings - Fork 5
Web servers
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.
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.
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.
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.
- File-based routing
- Page views
- Page logic
- Dynamic URIs
- Headers and footers
- Custom HTML components
- Page partials
- Binding data to the DOM
- DOM manipulation
- Hello You tutorial
- Todo list tutorial
- Address book tutorial WIP
- Blueprints
- Application architecture
- Coding styleguide WIP
- PHP environment setup WIP
- Web servers WIP
- Background cron tasks
- Database setup WIP
- Client-side compilation WIP
- Testing WebEngine applications WIP
- Production checklist WIP
- Security WIP