只要添加另一种方法,您就可以为托管的每个虚拟域或站点使用单独的文件。
可以使用默认副本作为每个站点的起点,并为每个站点进行自定义。
Then create symlinks in sites-enabled. In this way you can take sites up and down just by adding or removing a symlink and issuing a service nginx reload.
当您进行网站维护时,您可以创造性地使用此方法将网站重定向到维护模式页面。
结构是这样的:
/sites-available/ (you can use obvious file names like this)
|
|-> a.mysite.com
|-> b.mysite.com
|-> someOtherSite.com
/sites-enabled/ (these are just symlinks to the real files in /sites-available)
|
|-> a.mysite.com
|-> b.mysite.com
Notice that since there are only the first two entries are the only symlinked items in sites-enabled, the third entry, someOtherSite.com is therefore offline.
You symlink the default file from sites available to sites enabled. Then you modify the available site to include two server blocks each with a different server_name. see the following. This assumes you have to domains called example.com and example2.com. You would also have pointed your @records to the ip address of the server where you've installed nginx.