Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mhopkins321's avatar

Nginx site/server based on hostname + uri segment?

I'm wondering if there is a way I can set up two different nginx sites (or servers, unsure the proper term) that will filter requests based not only on hostname, but the first segment of a uri.

Meaning, all requests sent to http://url.com will have a document root of /path/project/public and all requests sent to http://url.com/admin will have a document root of /path/admin/public. Is this possible?

EDIT: I am wondering if this is similar to the posts I've seen about setting up laravel at a sub directory? I'm not sure, I usually associate something like that with shared hosting. /shrug

0 likes
0 replies

Please or to participate in this conversation.