Skip to content

Instantly share code, notes, and snippets.

@gingerbeardman
Created January 7, 2025 20:21
Show Gist options
  • Save gingerbeardman/23e0da9949a8d41ebd190d60b0bd033b to your computer and use it in GitHub Desktop.
Save gingerbeardman/23e0da9949a8d41ebd190d60b0bd033b to your computer and use it in GitHub Desktop.
Access control and permissions
#!/bin/bash
# Create the directory if it doesn't exist
sudo mkdir -p /var/log/caddy
# Set ownership to caddy user and group
sudo chown caddy:caddy /var/log/caddy
# Set appropriate permissions (755 for directory)
sudo chmod 755 /var/log/caddy
# Set correct SELinux context for logs
sudo semanage fcontext -a -t httpd_log_t "/var/log/caddy(/.*)?"
sudo restorecon -Rv /var/log/caddy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment