nginx: how to serve multiple site on same domain name without virtual hosting?

I'm new of nginx. I read some documentation to install it and configure it with drupal 8.

I have my server installed on linode. i access through ip address, not virtual host.

My drupal is located in var/www/html/d8/web.

So, to access my drupal site I type ip-address/d8/web.

if root /var/www/html/d8/web is in server default file it works well. In this way I can't access other website in my server, every time I must change root directory in default file.

I tried with

location (d8/web/ {
 try_files $uri /index.php?$query_string
} 

but, if root is an other directory, Nginx serves index.php in that directory.

The problem is I can't set server names, cause I work with ip address instead of virtual host. I access Linode from my Windows pc.

Some ideas or suggestions?


Solution 1:

Then you clearly need one different IP for each site, stating them in the listen clause of the each server {} block.