Advertisement
Guest User

Broken Caddyfile

a guest
Dec 6th, 2018
3,560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. # Only redirect if the request is for the webroot
  2. redir 301 {
  3. if {path} is /
  4. / https://mysite.com
  5. }
  6.  
  7. # Code for Cloudflare DNS:
  8. # Cloudflare Caddy plugin and Environment variables are required
  9.  
  10. # Environment Variables:
  11. CLOUDFLARE_EMAIL myemail@gmail.com
  12. CLOUDFLARE_API_KEY d5188c43543543543543508a00043324324
  13.  
  14. # Code:
  15. tls {
  16. dns cloudflare
  17. }
  18.  
  19. ########################### Code Starts Below ##################################
  20.  
  21. #################
  22. # Code Snippets #
  23. #################
  24.  
  25. # Snippet 1
  26. (myCommon) {
  27. ext .html .htm .php
  28. root C:\Servers\Sites\MyWeb
  29. gzip
  30.  
  31. header / {
  32. X-Content-Type-Options nosniff
  33. X-XSS-Protection "1; mode=block"
  34. Strict-Transport-Security "max-age=31536000;"
  35. }
  36. }
  37.  
  38. # Snippet 2
  39. (myLocations) {
  40.  
  41. proxy /tautulli 127.0.0.1:9001 { # https://github.com/Tautulli/Tautulli
  42. header_upstream X-Forwarded-Host {host}
  43. transparent
  44. }
  45.  
  46. proxy /ombi 127.0.0.1:9002 { # https://github.com/tidusjar/Ombi
  47. transparent
  48. }
  49.  
  50. proxy /radarr 127.0.0.1:9003 { # https://github.com/Radarr/Radarr
  51. transparent
  52. }
  53.  
  54. proxy /sonarr 127.0.0.1:9004 { # https://sonarr.tv/
  55. transparent
  56. }
  57.  
  58. proxy /organizr 127.0.0.1:3112 { # https://github.com/causefx/Organizr
  59. transparent
  60. }
  61.  
  62. proxy /gogs 127.0.0.1:9006 { # https://github.com/gogs/gogs
  63. transparent
  64. }
  65.  
  66. proxy /duplicati 127.0.0.1:8200 { # https://
  67. transparent
  68. }
  69.  
  70. proxy /medusa 127.0.0.1:9005 { # https://
  71. transparent
  72. }
  73.  
  74. #proxy /sabnzb 127.0.0.1:8080 { # https://sabnzbd.org/
  75. # transparent
  76. #}
  77.  
  78. #proxy /nzbget 127.0.0.1:6789 { # http://nzbget.net
  79. # transparent
  80. #}
  81.  
  82. proxy /nzbhydra 127.0.0.1:5075 { # https://github.com/theotherp/nzbhydra
  83. transparent
  84. }
  85.  
  86. proxy /deluge 127.0.0.1:8333 { # http://deluge-torrent.org/
  87. without /deluge
  88. transparent
  89. header_upstream X-Deluge-Base "/deluge"
  90. }
  91.  
  92. # The code below will proxy PHP requests
  93. fastcgi / 127.0.0.1:9133 php
  94. }
  95.  
  96. ################################################################################
  97. # web domain server block
  98. ################################################################################
  99.  
  100. home.mysite.com {
  101.  
  102. tls myemail@gmail.com # Email for Let's Encrypt Verification
  103.  
  104. log C:\Servers\Sites\MyWeb\Logs\Caddy\CaddyAccessLog.txt {
  105. rotate_size 1 # Rotate after 1 MB
  106. rotate_age 7 # Keep log files for 7 days
  107. rotate_keep 2 # Keep at most 2 log files
  108. }
  109.  
  110. # Change path syntax for your OS or your preferred location!
  111. errors C:\Servers\Sites\MyWeb\Logs\Caddy\Caddy-ErrorLog.txt {
  112. rotate_size 1 # Set max size 1 MB
  113. rotate_age 7 # Keep log files for 7 days
  114. rotate_keep 2 # Keep at most 2 log files
  115. }
  116.  
  117. # Change path(s) to your PHP folder location
  118. 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 &
  119.  
  120. import myCommon # Import code snippet 1
  121. import myLocations # Import code snippet 2
  122.  
  123. }
  124.  
  125. ################################################################################
  126. # localhost or Machine server block
  127. ################################################################################
  128.  
  129. #http://localhost http://192.168.0.x http://10.0.1.x {
  130.  
  131. :4444 {
  132.  
  133. import myCommon # Import code snippet 1
  134. import myLocations # Import code snippet 2
  135.  
  136. }
  137.  
  138. ################################################################################
  139. # Plex subdomain code block
  140. ################################################################################
  141.  
  142. plex.mysite.com {
  143.  
  144. gzip
  145.  
  146. # Separate log file for Plex server
  147. log C:\Servers\Sites\MyWeb\Logs\CaddyPlex\Caddy-PlexAccessLog.txt {
  148. rotate_size 1 # Rotate after 1 MB
  149. rotate_age 7 # Keep log files for 7 days
  150. rotate_keep 2 # Keep at most 2 log files
  151. }
  152.  
  153. errors C:\Servers\Sites\MyWeb\Logs\CaddyPlex\Caddy-PlexErrorLog.txt {
  154. rotate_size 1 # Set max size 1 MB
  155. rotate_age 7 # Keep log files for 7 days
  156. rotate_keep 2 # Keep at most 2 log files
  157. }
  158.  
  159. proxy / 127.0.0.1:32400 {
  160. transparent
  161. }
  162.  
  163. }
  164.  
  165. ################################################################################
  166. # Sonarr subdomain code block example
  167. ################################################################################
  168.  
  169. # Remember to disable/remove the base url settings from within the app!
  170. # Else "/sonarr" will be appended to the domain and will defeat the purpose of
  171. # using a subdomain.
  172. # (e.g. sonarr.domain.com will become "sonarr.domain.com/sonarr")
  173.  
  174. sonarr.mysite.com {
  175.  
  176. gzip
  177.  
  178. proxy / 127.0.0.1:9004 {
  179. transparent
  180. }
  181.  
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement