Modularize Nginx wordpress-site.conf.j2 and add Nginx conf hooks #688
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trellis Nginx includes have been limited to one location, inside the primary
server
block. This PR adds hooks to enable users to include files or inject snippets in other locations (e.g., outsideserver
block). Here is an example of needing to inject a directive in thehttp
context.The docs in roots/docs#57 will be most helpful for understanding the intent of this PR. Builds on #687
This PR is simpler than it looks. The first commit accounts for most all the PR's additions/deletions, and doesn't change code. It just breaks the WordPress site conf out into separate modules/files. The second commit (Nginx hooks) adds only 13 lines.
The modularization of the Nginx confs is for convenience, to make the sections clear amongst all the jinja templating complexity. This is the approach already in use for
roles/wordpress-setup/templates/https.conf.j2
.The one change made in the modularization is that this PR moves the base WordPress conf out of the
nginx
role into thewordpress-setup
role. This changes this base WP conf from aninclude
whose content is general to all sites, to content injected into each site's conf such that it can be customized per site, via thenginx_location
hook.