sudo bash mjolnir example.com -FC
or
sudo mjolnir example.com -FC
//Optional Dependencies
certbotThis library is meant to act as a back-end tool to generate the necessary files and configurations for creations of new virtual hosts (web domains).
If you wish to use secure ssl (https), make sure to install certbot as this script has the ability to incorporate certbot to automate this process as much as possible.
sudo mjolnir <domainname> [Options]
# preview-only mode
sudo mjolnir <domainname> [Options] -dryrun
# self-install to /usr/bin/mjolnir (overwrites existing)
sudo bash mjolnir -
# self-update from local git checkout, then refresh /usr/bin/mjolnir
sudo mjolnir --self-updateVirtual Host Config, Enabling website, creation of public and dev subdirectories, index.php and htaccess creation, SSL Certificates for secure https via Certbot.
sudo bash mjolnir example.com -FCVirtual Host Config, Enabling website, creation of public and dev subdirectories, index.php and htaccess creation.
sudo bash mjolnir example.com -FRemove a website's folders and config files, disable site and restart apache.
sudo bash mjolnir example.com -RVirtual Host Config, Enabling website, creation of public and dev subdirectories, index.php and htaccess creation.
sudo bash mjolnir example.com -SSL
or
sudo bash mjolnir example.com -COverwrites the Virtual Host file for the website given with the newest, updated version defined in the script.
sudo bash mjolnir example.com -VPreview what Mjolnir would do without writing files, restarting Apache, or running certbot.
sudo mjolnir example.com -F -dryrun
# also works with dryrun before action
sudo mjolnir example.com -dryrun -FInstalls mjolnir to /usr/bin/mjolnir, overwriting the existing binary/script.
sudo bash mjolnir -Updates from the current git checkout using a fast-forward pull, then reinstalls to /usr/bin/mjolnir.
If no git checkout is detected (or git pull fails), it falls back to downloading from the public repo source.
sudo mjolnir --self-updateNotes:
- Git mode protects local changes by blocking update when the checkout is dirty.
- Fallback mode downloads from
https://github.com/Cazgem/mjolnirpublic source and does not require git credentials. - Fallback mode automatically tries both
mainandmasterraw branch URLs.
Developed by Cazgem (https://cazgem.com) for internal use as part of Divisi Labs and Polyphony (https://divisilabs.com/getpolyphony).
If your live and dev servers use the same folder layout (for example /srv/www/<domain>/html and /srv/www/<domain>/dev), run Mjolnir independently on each machine.
- Install Apache and this script on both servers.
- Keep
WEBDIRand Apache paths identical on both hosts. - Point DNS to each machine's public IP as needed:
example.comandwww.example.com-> live server IPdev.example.com-> dev server IP
- Run Mjolnir on each host only for the domains that host serves.
On live:
sudo mjolnir example.com -FOn dev:
sudo mjolnir example.com -DIf certbot is installed on each server, issue certs on each host after DNS is correct:
sudo mjolnir example.com -C- This script writes local Apache config files only on the machine where it is run.
- The same domain can exist on both hosts as long as DNS records direct traffic to the intended server.
- Use
sudo mjolnir anything -configtestto validate Apache config syntax before restart-level changes.