Skip to content

mkvhost

omgslinux edited this page Mar 6, 2025 · 1 revision

Th mkvhost.sh file is the bash script that contains the logic to generate the vhost files. It has to be run from the main directory (i.e. ./mkvhost.sh <args>), being the <args> directory names relative to the main directory.

What it does:

  • Being <dir> each one of <args>, include any *.inc files inside <dir>
  • According to the template definitions, copy extra config files in the _conf/ directory to /etc/nginx/conf if they don't exist. If the necessary file already exists in the target directory, no copy will take place.
  • Similarly, files in _snippets/ directory will be copied when necessary to /etc/nginx/snippets directory.
  • Create/Overwrite the vhost file in ../sites-available/${SERVER} (with the SERVER variable defined in your vhost). There will be a server block for http, and below, a separate server block for https in the same file, according to the definitions in the vhost .inc file. If necessary, make sure to backup an existing file with your previous definition.
  • Remove and recreate the symlink ../sites-enabled/${SERVER}
  • Create the specific directory for logs if it doesn't exist
Clone this wiki locally