Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Only redirect if the request is for the webroot
- redir 301 {
- if {path} is /
- / https://mysite.com
- }
- # Code for Cloudflare DNS:
- # Cloudflare Caddy plugin and Environment variables are required
- # Environment Variables:
- CLOUDFLARE_EMAIL myemail@gmail.com
- CLOUDFLARE_API_KEY d5188c43543543543543508a00043324324
- # Code:
- tls {
- dns cloudflare
- }
- ########################### Code Starts Below ##################################
- #################
- # Code Snippets #
- #################
- # Snippet 1
- (myCommon) {
- ext .html .htm .php
- root C:\Servers\Sites\MyWeb
- gzip
- header / {
- X-Content-Type-Options nosniff
- X-XSS-Protection "1; mode=block"
- Strict-Transport-Security "max-age=31536000;"
- }
- }
- # Snippet 2
- (myLocations) {
- proxy /tautulli 127.0.0.1:9001 { # https://github.com/Tautulli/Tautulli
- header_upstream X-Forwarded-Host {host}
- transparent
- }
- proxy /ombi 127.0.0.1:9002 { # https://github.com/tidusjar/Ombi
- transparent
- }
- proxy /radarr 127.0.0.1:9003 { # https://github.com/Radarr/Radarr
- transparent
- }
- proxy /sonarr 127.0.0.1:9004 { # https://sonarr.tv/
- transparent
- }
- proxy /organizr 127.0.0.1:3112 { # https://github.com/causefx/Organizr
- transparent
- }
- proxy /gogs 127.0.0.1:9006 { # https://github.com/gogs/gogs
- transparent
- }
- proxy /duplicati 127.0.0.1:8200 { # https://
- transparent
- }
- proxy /medusa 127.0.0.1:9005 { # https://
- transparent
- }
- #proxy /sabnzb 127.0.0.1:8080 { # https://sabnzbd.org/
- # transparent
- #}
- #proxy /nzbget 127.0.0.1:6789 { # http://nzbget.net
- # transparent
- #}
- proxy /nzbhydra 127.0.0.1:5075 { # https://github.com/theotherp/nzbhydra
- transparent
- }
- proxy /deluge 127.0.0.1:8333 { # http://deluge-torrent.org/
- without /deluge
- transparent
- header_upstream X-Deluge-Base "/deluge"
- }
- # The code below will proxy PHP requests
- fastcgi / 127.0.0.1:9133 php
- }
- ################################################################################
- # web domain server block
- ################################################################################
- home.mysite.com {
- tls myemail@gmail.com # Email for Let's Encrypt Verification
- log C:\Servers\Sites\MyWeb\Logs\Caddy\CaddyAccessLog.txt {
- rotate_size 1 # Rotate after 1 MB
- rotate_age 7 # Keep log files for 7 days
- rotate_keep 2 # Keep at most 2 log files
- }
- # Change path syntax for your OS or your preferred location!
- errors C:\Servers\Sites\MyWeb\Logs\Caddy\Caddy-ErrorLog.txt {
- rotate_size 1 # Set max size 1 MB
- rotate_age 7 # Keep log files for 7 days
- rotate_keep 2 # Keep at most 2 log files
- }
- # Change path(s) to your PHP folder location
- on startup C:\Servers\PHP\7.2.12\php-cgi -b 127.0.0.1:9133 -c C:\Servers\PHP\7.2.12\php.ini &
- import myCommon # Import code snippet 1
- import myLocations # Import code snippet 2
- }
- ################################################################################
- # localhost or Machine server block
- ################################################################################
- #http://localhost http://192.168.0.x http://10.0.1.x {
- :4444 {
- import myCommon # Import code snippet 1
- import myLocations # Import code snippet 2
- }
- ################################################################################
- # Plex subdomain code block
- ################################################################################
- plex.mysite.com {
- gzip
- # Separate log file for Plex server
- log C:\Servers\Sites\MyWeb\Logs\CaddyPlex\Caddy-PlexAccessLog.txt {
- rotate_size 1 # Rotate after 1 MB
- rotate_age 7 # Keep log files for 7 days
- rotate_keep 2 # Keep at most 2 log files
- }
- errors C:\Servers\Sites\MyWeb\Logs\CaddyPlex\Caddy-PlexErrorLog.txt {
- rotate_size 1 # Set max size 1 MB
- rotate_age 7 # Keep log files for 7 days
- rotate_keep 2 # Keep at most 2 log files
- }
- proxy / 127.0.0.1:32400 {
- transparent
- }
- }
- ################################################################################
- # Sonarr subdomain code block example
- ################################################################################
- # Remember to disable/remove the base url settings from within the app!
- # Else "/sonarr" will be appended to the domain and will defeat the purpose of
- # using a subdomain.
- # (e.g. sonarr.domain.com will become "sonarr.domain.com/sonarr")
- sonarr.mysite.com {
- gzip
- proxy / 127.0.0.1:9004 {
- transparent
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement