Welcome! Log In Create A New Profile

Advanced

domain part of $host

Posted by indul 
domain part of $host
August 20, 2010 07:41AM
Hi Members,
I have a working nginx server with ~50 virtual domains, 150+ virtual hosts. I would like to simplify my config file. Now every domain has a separate config file with virtual host configs. My clients upload their content via ftp, every client sees his whole domain.
I would like to serve that content from the following direcory structure:

/domain1.tld/www.domain1.tld -> www.domain1.tld
/domain1.tld/sub1.domain1.tld -> sub1.domain1.tld
/domain1.tld/subsub1.domain1.tld -> subsub1.sub1.domain1.tld

/domain2.tld/www.domain2.tld -> www.domain2.tld
/domain2.tld/sub2.domain2.tld -> sub1.domain2.tld
/domain2.tld/subsub2.domain1.tld -> subsub2.sub2.domain2.tld

etc.

How can I exctract the domain name (domain1.tld) from the request ($host -> eg. sub1.domain1.tld)?
My goal is, to exctact the domain, and subsitute it in the nginx.conf as a part of the directory stucture. (/$domain/$host/)

Thank you in anticipation.

In Dul
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 322
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready