This is an old revision of the document!
: Explain the page/service.
Using Caddy to host the list, Love Letter counter, and reverse proxy many internal sites
DNS
Add record
Type
> CNAME
Name
> <subdomain>Target
> <domain name>Proxy status
> DNS only
Save
Install a base installation of Photon OS with the following changes:
Caddy
Setup minimal installed profile of PhotonOS
OVA with virtual hardware v15
from https://github.com/vmware/photon/wiki/Downloading-Photon-OSCreate/Register VM
:Deploy a virtual machine from an OVF or OVA file
Target Datastore
Power on automatically
Finish
Host
> Manage
> System
> Autostart
:Enable
Start earlier
and Start later
to set the desired orderVirtual Machines
on the sidebar and click on the current VMActions
> Edit Settings
:Add other device
> NVMe controller
Hard Disk 1
> Controller location
> NVMe controller 0
Edit Settings
SCSI controller 0
Hardware Configuration
> Network adapter 1
) and desired hostname# Login with root details from the VM note # Follow instructions to set new password # Remove docker related packages if not needed to save space and faster updates tdnf erase containerd docker docker-cli docker-engine # Update packages: tdnf upgrade tdnf clean all # Disable password expiry: chage -M -1 root # Set new hostname: hostnamectl set-hostname <hostname-as-set-in-router> # Set the timezone to Perth ln -sf /usr/share/zoneinfo/Australia/Perth /etc/localtime # Change the SSH port to 50001: sed -i "s/#Port 22/Port 50001/" /etc/ssh/sshd_config sed -i "s/-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT/-A INPUT -p tcp -m tcp --dport 50001 -m state --state NEW -j ACCEPT/" /etc/systemd/scripts/ip4save exit
Minimal installed profile of PhotonOS User: root Ports: 50001/tcp SSH
Base Install
http,https
to the IP of the VM# Allow http/https through iptables sed -i "s/COMMIT/-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT\n-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT\nCOMMIT/" /etc/systemd/scripts/ip4save reboot # And then reconnect the SSH client # Download Caddy tdnf install tar mkdir /tmp/caddydir # Copy the link for the "caddy_2.x.x_linux_amd64.tar.gz" file from https://github.com/caddyserver/caddy/releases/latest curl -L -o /tmp/caddydir/caddy.tar.gz "<DownloadLink>" tar -xzf caddy.tar.gz -C /tmp/caddydir mv /tmp/caddydir/caddy /usr/bin/ rm /tmp/caddydir/* # Add the caddy group and user groupadd --system caddy useradd --system \ --gid caddy \ --create-home \ --home-dir /var/lib/caddy \ --shell /usr/sbin/nologin \ --comment "Caddy web server" \ caddy # Config file and html pages cd /usr/bin curl -L -o "fetch" "https://github.com/gruntwork-io/fetch/releases/latest/download/fetch_linux_amd64" chmod u+x fetch # Generate a GitHub Personal Access Token at https://github.com/settings/tokens fetch --repo="https://github.com/Archer4499/Configs" --branch="master" --source-path="/Server/Caddy" --github-oauth-token="<GitHub PAT>" /etc/caddy chmod -R a=r,u+w,a+X /etc/caddy # Setup startup, and run curl -L -o /etc/systemd/system/caddy.service "https://raw.githubusercontent.com/caddyserver/dist/master/init/caddy.service" systemctl daemon-reload systemctl enable caddy systemctl start caddy
80,443/tcp Http,Https Caddy
Configured
# View the Caddy log (add -n <num> to see the latest <num> entries, or -f to actively follow the log) journalctl -u caddy # Use updated config file systemctl reload caddy
@No_Backup
tdnf upgrade
tdnf clean all
reboot # If desired/needed
# Update Caddy caddy version # Compare with the version from https://github.com/caddyserver/caddy/releases/latest and copy the link for the "caddy_2.x.x_linux_amd64.tar.gz" file if newer curl -L -o /tmp/caddydir/caddy.tar.gz "<DownloadLink>" tar -xzf caddy.tar.gz -C /tmp/caddydir mv /tmp/caddydir/caddy /usr/bin/ rm /tmp/caddydir/* systemctl reload caddy # Update just config # Generate a GitHub Personal Access Token at https://github.com/settings/tokens fetch --repo="https://github.com/Archer4499/Configs" --branch="master" --source-path="/Server/Caddy/Caddyfile" --github-oauth-token="<GitHub PAT>" /etc/caddy/Caddyfile # Update Config and HTML rm -r /etc/caddy # Generate a GitHub Personal Access Token at https://github.com/settings/tokens fetch --repo="https://github.com/Archer4499/Configs" --branch="master" --source-path="/Server/Caddy" --github-oauth-token="<GitHub PAT>" /etc/caddy chmod -R a=r,u+w,a+X /etc/caddy # Use updated config file systemctl reload caddy