5

And what are performance implications? Is it practical to host tens of thousands of vhosts on one Nginx instance? How much would the increased latency be?

We plan to offer custom domains for users, and to assign different chroot per user and to serve static assets like js/css directly from nginx, we want to host as many users per nginx instance as possible.

kenn
  • 625
  • 1
  • 5
  • 10

1 Answers1

2

If you don't require dynamic content, fastcgi daemons etcetera, unlimited vhosts can be as simple as this SF answer.

server_name *.dom.tld;
root /var/www/$http_host/public;

In that case, your first bottleneck will likely be the filesystem, not Nginx.

Also note that major reverse proxies such as Cloudflare use (a modified version of) Nginx, so it sounds plausible to do.

Willem
  • 2,712
  • 3
  • 27
  • 34
  • Thanks! Is "server_name *;" an acceptable value? When we use custom domains, not subdomains. Then it's a perfect solution! – kenn Nov 09 '14 at 18:48
  • Yes, see also: http://nginx.org/en/docs/http/server_names.html So I wonder, How come this question is still relevant after almost 2 years? ;) – Willem Nov 12 '14 at 12:30
  • Took another route at the time - now I'm commenting out of pure interest. :) – kenn Nov 13 '14 at 19:58
  • @kenn which route did you ultimately take? – Snowball Mar 27 '18 at 08:34