I'm creating a system where users have their own website on my server with a custom domain, upon an input they desire, e.g.
On one condition, the main domain is domain.org, but domain.org, domain.biz points to the server, but nginx uses the domain.org, how can I let it use domain.biz at the same time?
So if I want a custom script that allows it via command line (that can be run via PHP) that creates a directory in the
sites-available and a
conf file in the
sites-enabled directory so that I can have customised sites in the two directories so when accessing to the custom domain the user entered.
Overall it should:
- Create a "virtual host" directory in
sites-availableand add a conf file in the
- Restart nginx (can a site be added without a restart being required?).
I saw this script, it does what I want, but I need this to take effect on
domain.org since when I enter
./create_site_simple.sh test.domain.biz, it works, but it only works for
test.domain.biz which isn't what I need.
Also I'd like to be able to delete virtualhosts under the command line (via PHP of course).