Adding Non-WP Subdomains inside Bedrock with proper Trellis Deployment

Hello guys

I’m trying to get a kind of like a specific setup for an app that i’m working on. Let me explain:

I’m building a site which is going to be huge, woocommerce, bunch of woocommerce plugins, blog, pages, etc, etc, etc.

I fell in love with the way Bedrock organizes the files, and even better with the Trellis deployment which i got all that setup.

Now, my app is going to have 2 more sections which are non WP. 1 is an API, and the other is an specific Admin section that i need to create outside of WP. Something like this.

example.com
–trellis
–sites
-----vendor
-----config
-----web
---------app
---------wp
---------admin <-- To host my admin.example.com
---------api <------ To host my api.example.com

So basically i want to setup this on Trellis in a way, that everything gets deployed with the proper subdomains working as intended. If i go to admin.example.com, then it pulls a new section, and it is calling /sites/web/admin, same goes for api, if i reach api.example.com, i want it to show /sites/web/api

Not sure if i was able to explain it properly, but … basically by putting this folders, i’m able to access them right now at example.com/api or example.com/admin, but i want this to be accessed as subdomains instead.

Any ideas will be highly appreciated.

Thanks in advanced for any help.

You’ll probably want to add a new role to Trellis which will create separate Nginx configs for those domains. Just like we do in the roles/wordpress-setup role.

Trellis does support adding files to be included in the Nginx confg, but they are included within the WP server block. You’d need 2 other top level blocks which isn’t supported.

Thank you so much for the help.

I will follow that roles path and see if i can get it to work.

Thank you so much.

Did you manage to get this to work? I’m sort of interested in doing a similar thing.