Advertisement
StarfighterZorg

Caddyfile (v0.10.x) - Reverse Proxy Usenet Apps Config

May 2nd, 2017
3,620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.91 KB | None | 0 0
  1. ####################################### New Caddyfile v0.10.x #################################################################
  2.  
  3. # Notes: (Last edit: 7/15/18)
  4.  
  5. # Old caddyfile v0.9.x: (Deprecated but has a lot more notes and setup information if needed!)
  6. # https://pastebin.com/sFUdPFvM
  7.  
  8. # Some code for people who don't want to serve any sites from root domain
  9. # The redir will send people to google.com when they try to reach yourdomain.com
  10. # Code Source: http://bit.ly/2sVL78h
  11.  
  12. redir 301 {
  13. if {path} is / # Only redirect if the request is for the webroot
  14. / https://www.google.com # Replace with wherever you like
  15. }
  16.  
  17. # If you're planning on using subdomains instead of subfolders for your apps then don't use a "common.conf" file since
  18. # all the relevant code should go in the server block instead of being pulled in through the import of another file!
  19.  
  20. # Code for cloudflare dns: **Cloudflare caddy plugin and Environment variables are required**
  21.  
  22. # Environment Variables:
  23.  
  24. # CLOUDFLARE_EMAIL xxxxxxxxxxxxxx
  25. # CLOUDFLARE_API_KEY xxxxxxxxxxxxxx
  26.  
  27. # Code:
  28.  
  29. # tls {
  30. # dns cloudflare
  31. # }
  32.  
  33. # In caddy v0.10.10 "startup" is deprecated and the new "on" directive will take it's place
  34.  
  35. # The link below has more info on how to use the new "on" syntax needed for startup
  36. # https://caddyserver.com/docs/on
  37.  
  38. # With Windows it might be better to use: on startup "\"C:\caddy\php\php-cgi.exe\" -b 127.0.0.1:9000" &
  39.  
  40. # Caddy introduced Snippets to v0.10.11 to help make reusing code simpler (https://caddyserver.com/blog/caddy-0_10_11-released)
  41. # This will eliminate needing a separate "common.conf" file but your free to keep using it if you prefer!
  42.  
  43. # You would define a site block with parentheses around the name (e.g.)
  44.  
  45. # (mysnippet) {
  46. # gzip
  47. # header.....
  48. # proxy.......
  49. # }
  50.  
  51. # Updated Tautulli(formerly PlexPy) Github address
  52.  
  53. # Removed the rewrite code that was initially needed for Ombi V3 but now looks like it's unnecessary!
  54.  
  55. # Change all path "syntax" & "locations" to match your OS! e.g. "c:\caddy\www" for Windows or "/var/www" for nix file systems
  56. ################################################## Code starts below ##########################################################
  57.  
  58. ####################################################################################
  59. # Snippets
  60. ####################################################################################
  61.  
  62. ####### Snippet 1 #######
  63.  
  64. (mycommon) {
  65. ext .html .htm .php
  66. root /caddy/www # Change path & syntax for your OS or your preferred location!
  67. gzip
  68.  
  69. header / {
  70. X-Content-Type-Options nosniff
  71. X-XSS-Protection "1; mode=block"
  72. Strict-Transport-Security "max-age=31536000;"
  73. }
  74. }
  75.  
  76. ####### Snippet 2 #######
  77.  
  78. (mylocations) {
  79.  
  80. # You can normally use "127.0.0.1", use the appropriate "IP address" if your running the web server/apps on different machines
  81.  
  82. proxy /sabnzb 127.0.0.1:8080 { # https://sabnzbd.org/
  83. transparent
  84. }
  85.  
  86. proxy /htpc 127.0.0.1:8085 { # http://htpc.io/
  87. transparent
  88. }
  89.  
  90. proxy /headphones 127.0.0.1:8181 { # https://github.com/rembo10/headphones
  91. transparent
  92. }
  93.  
  94. proxy /mylar 127.0.0.1:8090 { # https://github.com/evilhero/mylar
  95. transparent
  96. }
  97.  
  98. proxy /lazy 127.0.0.1:5299 { # https://github.com/DobyTang/LazyLibrarian
  99. transparent
  100. }
  101.  
  102. proxy /emby 127.0.0.1:8096 { # https://emby.media/
  103. transparent
  104. }
  105.  
  106. proxy /sonarr 127.0.0.1:8989 { # https://sonarr.tv/
  107. transparent
  108. }
  109.  
  110. # Headphones uses port 8181 so make sure there's no conflict!
  111.  
  112. proxy /tautulli 127.0.0.1:8181 { # https://github.com/Tautulli/Tautulli
  113. header_upstream X-Forwarded-Host {host}
  114. transparent
  115. }
  116.  
  117. proxy /nzbget 127.0.0.1:6789 { # http://nzbget.net/
  118. transparent
  119. }
  120.  
  121. proxy /couch 127.0.0.1:5050 { # https://couchpota.to/
  122. transparent
  123. }
  124.  
  125. proxy /nzbhydra 127.0.0.1:5075 { # https://github.com/theotherp/nzbhydra
  126. transparent
  127. }
  128.  
  129. proxy /ombi 127.0.0.1:3579 { # https://github.com/tidusjar/Ombi
  130. transparent
  131. }
  132.  
  133. # The rewrite makes sure all of glances sub directory calls are proxied from domain to host
  134.  
  135. rewrite {
  136. if {>Referer} has /glances
  137. to /glances/{path}
  138. }
  139.  
  140. # The code below gives you a tiny level of security requiring a username/password before Caddy will let you connect to it
  141.  
  142. basicauth /glances Username Password
  143.  
  144. proxy /glances 127.0.0.1:61208 { # https://github.com/nicolargo/glances
  145. without /glances
  146. transparent
  147. }
  148.  
  149. proxy /deluge 127.0.0.1:8112 { # http://deluge-torrent.org/
  150. without /deluge
  151. transparent
  152. header_upstream X-Deluge-Base "/deluge"
  153. }
  154.  
  155. proxy /watcher 127.0.0.1:9090 { # https://github.com/nosmokingbandit/Watcher3
  156. transparent
  157. }
  158.  
  159. proxy /radarr 127.0.0.1:7878 { # https://github.com/Radarr/Radarr
  160. transparent
  161. }
  162.  
  163. # The code below will proxy PHP requests
  164.  
  165. fastcgi / 127.0.0.1:9000 php
  166. }
  167.  
  168. ####################################################################################
  169. # web domain server block
  170. ####################################################################################
  171.  
  172. domain.com {
  173.  
  174. tls yourname@email.com # Email for Let's Encrypt Verification
  175.  
  176. # New log directive syntax for v0.10.x
  177. log /caddy/logs/access.log { # Change path syntax for your OS or your preferred location!
  178. rotate_size 1 # Rotate after 1 MB
  179. rotate_age 7 # Keep log files for 7 days
  180. rotate_keep 2 # Keep at most 2 log files
  181. }
  182.  
  183. errors /caddy/logs/error.log { # Change path syntax for your OS or your preferred location!
  184. rotate_size 1 # Set max size 1 MB
  185. rotate_age 7 # Keep log files for 7 days
  186. rotate_keep 2 # Keep at most 2 log files
  187. }
  188.  
  189. on startup /caddy/php/php-cgi -b 127.0.0.1:9000 -c /caddy/php/php.ini & # Change path/s to your PHP folder location
  190.  
  191. import mycommon # Import code snippet 1 defined above
  192. import mylocations # Import code snippet 2 defined above
  193.  
  194. }
  195.  
  196. ####################################################################################
  197. # localhost or Machine server block
  198. ####################################################################################
  199.  
  200. http://localhost http://192.168.1.x http://10.0.1.x {
  201.  
  202. import mycommon # Import code snippet 1 defined above
  203. import mylocations # Import code snippet 2 defined above
  204.  
  205. }
  206.  
  207. ####################################################################################
  208. # Plex subdomain code block
  209. ####################################################################################
  210.  
  211. plex.yourdomain.com {
  212.  
  213. gzip
  214.  
  215. # Separate log file for Plex server
  216.  
  217. log /caddy/logs/plexaccess.log {
  218. rotate_size 1 # Rotate after 1 MB
  219. rotate_age 7 # Keep log files for 7 days
  220. rotate_keep 2 # Keep at most 2 log files
  221. }
  222.  
  223. errors /caddy/logs/plexerror.log {
  224. rotate_size 1 # Set max size 1 MB
  225. rotate_age 7 # Keep log files for 7 days
  226. rotate_keep 2 # Keep at most 2 log files
  227. }
  228.  
  229. proxy / 127.0.0.1:32400 {
  230. transparent
  231. }
  232.  
  233. }
  234.  
  235. ####################################################################################
  236. # Sonarr subdomain code block example
  237. ####################################################################################
  238.  
  239. # Remember to disable/remove the base url settings from within the app! Else "/sonarr" will be appended to the domain and will
  240. # defeat the purpose of using a subdomain. (e.g. sonarr.domain.com will become "sonarr.domain.com/sonarr")
  241.  
  242. sonarr.yourdomain.com {
  243.  
  244. gzip
  245.  
  246. proxy / 127.0.0.1:8989 {
  247. transparent
  248. }
  249.  
  250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement