Static files
Static
HTTP middleware serving static content using RoadRunner on the main HTTP plugin endpoint. Using this middleware can slow down the overall performance by up to ~10%
, because RoadRunner has to check the path for each file request.
Enable HTTP Middleware
To enable static content serving use the configuration inside the http section:
Where:
dir
: path to the directory.forbid
: file extensions that should not be served.allow
: extensions that should be served (empty - serve all except forbidden). If extension is present in both (allow and forbidden) hashmaps - that is treated as we should forbid file extension.calculate_etag
: enable etag calculation for the static file.weak
: use a weak generator (/W), it uses only filename to generate a CRC32 sum. If false - all file content used to generate CRC32 sum.request/response
: custom headers for the static files.
To combine static content with other middleware, use the following sequence (static is always last in the line, then headers and gzip):
Fileserver plugin
Fileserver plugin serves the static files. It works similar to the static
HTTP middleware and has extended functionality. Static HTTP middleware slows down request processing by ~10%
because RR has to check each request for the corresponding file. The file server plugin uses a different port and only serves static files.
File server configuration
Last updated
Was this helpful?