FrankenPHP Configuration¶
FrankenPHP adds PHP interpolation to web sites served by its underlying Caddy web server.
In this example we’ll create two documentation subdomainds, zen-php.langley.stream and pond-7-docs.langley.stream, which will serve static Zensical documentation sites with PHP interpolation enabled.
Caddy server¶
Edit the Caddy web server configuration¶
Caddy configuration for serving static Zensical documentation sites¶
### Begin zen-php.langley.stream configuration ###
zen-php.langley.stream {
root /opt/zensical/zensical-project/site
# 09/12/26: Serve both .php and .html files as php code:
# See: https://caddyserver.com/docs/caddyfile/matchers#path
@phpFiles {
path *.html *.php
}
php @phpFiles
encode
php_server
}
### End zen-php.langley.stream configuration ###
### Begin pond-7-docs.langley.stream configuration ###
pond-7-docs.langley.stream {
root /opt/zensical/pond-7-project/site
# 09/12/26: Serve both .php and .html files as php code:
# See: https://caddyserver.com/docs/caddyfile/matchers#path
@phpFiles {
path *.html *.php
}
php @phpFiles
encode
php_server
}
### End pond-7-docs.langley.stream configuration ###
Run the project inside web space¶
The folders for Docker compose projects are often placed under /root, however HTML files
usually cannot be served from inside root’s home directory.
Rather than copying Zensical’s generated static site folder to a web-accessible directory
we can relocate the entire Docker Zensical project into web-accessible space in /opt:
/opt/<project-name>
- Move Zensical’s Docker compose folder (containing docker-compose.yml) into
/opt: -
Assign directory permissions compatible with the web server user and group (www-data on Debian-based Linux):
-
Start the Zensical project container: