This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
esxi:caddy_server [2024/07/26 16:38] derek |
esxi:caddy_server [2024/09/22 19:51] (current) |
||
---|---|---|---|
Line 5: | Line 5: | ||
====Setup==== | ====Setup==== | ||
* Set up DNS with Cloudflare using [[web: | * Set up DNS with Cloudflare using [[web: | ||
- | * Add the desired publicly accessible subdomains | + | * For each domain |
- | * Navigate to the domain > '' | + | * Navigate to each domain > '' |
- | * For each subdomain: | + | * Add wildcard CNAME record: |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * Repeat | + | * Add a ' |
+ | * If not using a wildcard CNAME record, add a CNAME record for the desired subdomain as above | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
Install a base installation of Photon OS with the following changes: | Install a base installation of Photon OS with the following changes: | ||
Line 51: | Line 59: | ||
curl -L -o " | curl -L -o " | ||
chmod u+x fetch | chmod u+x fetch | ||
- | # Generate a GitHub Personal Access Token at https:// | + | |
- | fetch --repo=" | + | # Generate a GitHub Personal Access Token at https:// |
+ | # Enter the key when this command asks | ||
+ | read -rp "Enter github api token: " token && echo " | ||
+ | # Reload the shell so it exports the tokens in this session | ||
+ | exec $SHELL | ||
+ | |||
+ | fetch --repo=" | ||
chmod -R a=r,u+w,a+X /etc/caddy | chmod -R a=r,u+w,a+X /etc/caddy | ||
- | # Setup startup, and run | + | # Setup caddy startup |
curl -L -o / | curl -L -o / | ||
systemctl daemon-reload | systemctl daemon-reload | ||
+ | |||
+ | # Get a DNS API token from https:// | ||
+ | # Edit zone DNS > Use template: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Edit zone DNS > Use template: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Set up Google OAuth 2.0: | ||
+ | # Go to: [[https:// | ||
+ | # | ||
+ | # | ||
+ | |||
+ | systemctl edit caddy | ||
+ | # Paste in the following lines with their respective keys filled in: | ||
+ | [Service] | ||
+ | Environment=" | ||
+ | Environment=" | ||
+ | Environment=" | ||
+ | Environment=" | ||
+ | # Then save and exit the file with: ESC, :wq | ||
+ | |||
+ | # Enable and run the Caddy service | ||
systemctl enable --now caddy | systemctl enable --now caddy | ||
</ | </ | ||
Line 75: | Line 115: | ||
systemctl reload caddy | systemctl reload caddy | ||
</ | </ | ||
+ | |||
+ | Edit the Caddyfile at [[https:// | ||
+ | |||
+ | Services that require setting Trusted Proxies: | ||
+ | * [[esxi: | ||
+ | * [[home:Home Assistant]] | ||
+ | * [[esxi:AMP Game Server]] | ||
@No_Backup | @No_Backup | ||
Line 88: | Line 135: | ||
# Update Caddy | # Update Caddy | ||
caddy update | caddy update | ||
+ | chmod 755 / | ||
systemctl reload caddy | systemctl reload caddy | ||
- | # Once a year generate a new GitHub Personal Access Token at https:// | + | |
- | touch / | + | # Once a year generate a GitHub Personal Access Token at https:// |
- | vi / | + | # Enter the key when this command asks |
- | # Add the following line with your token using '' | + | read -rp "Enter api token: " token && echo " |
- | export GITHUB_OAUTH_TOKEN=< | + | # Reload the shell so it exports the tokens in this session |
- | # Reload the shell so it exports the token | + | |
exec $SHELL | exec $SHELL | ||