A host for serving multiple domains and sub-domains with redirection and more
web-host comprises of a setup that can help host Node.js websites over multiple domains and sub-domains, over or without SSL.
There's also other provisions like:
- Redirection to internally hosted or external websites
- Offline mode
Clone the project at the home directory. This is currently a requirement that may go away in the future.
# Clone the project
git clone https://github.com/team-fluxion/web-host.git
# Switch to project directory
cd web-host
# Install dependencies and commands with `make`
make install
Uninstalling would remove all the commands.
make uninstall
Or you can also re-install:
make reinstall
PS: SystemD is required to be the init system.
-
Place websites to host under the
apps
directory. Each website only needs to provide a script that exposes a single default function accepting an argument as the port that it listens on. -
(Optional) Create SSL certificates for the domains that need to be hosted over SSL, if at all.
-
Configure the host in file
config.json
mentioning the details of the certificates, websites and redirection.
Once everything is place, use the below installed commands:
host-start
- starts all websites, starts listening on port80
and443
(if using SSL) and sets up bouncing to appropriate websites according to request URLshost-stop
- stops all websiteshost-restart
- restarts the serverhost-offline
- stops the server but starts an offline mode on both: port80
and443
host-resume
- works exactly likehost-restart
host-status
- reports the current status of the host
- Add support for other init systems
- Switch to HTTP-only mode in absence of certificates
- Include a working example
- Improve commands and API