Advertisement
Guest User

Untitled

a guest
May 7th, 2018
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.39 KB | None | 0 0
  1. ####################################### New Caddyfile v0.10.x #################################################################
  2.  
  3. # Notes: (Last edit: 2/21/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. # Rewrite code needed for Ombi V3. There might be a better way to do the rewrite but for now this seems to work
  41. # Add before the proxy block for Ombi:
  42.  
  43. # rewrite {
  44. # r ^/dist
  45. # to /ombi/{uri}
  46. # }
  47.  
  48. # Caddy introduced Snippets to v0.10.11 to help make reusing code simpler (https://caddyserver.com/blog/caddy-0_10_11-released)
  49. # This will eliminate needing a separate "common.conf" file but your free to keep using it if you prefer!
  50.  
  51. # You would define a site block with parentheses around the name (e.g.)
  52.  
  53. # (mysnippet) {
  54. # gzip
  55. # header.....
  56. # proxy.......
  57. # }
  58.  
  59.  
  60. # Change all path "syntax" & "locations" to match your OS! e.g. "c:\caddy\www" for Windows or "/var/www" for nix file systems
  61. ################################################## Code starts below ##########################################################
  62.  
  63. ####################################################################################
  64. # Snippets
  65. ####################################################################################
  66.  
  67. ####### Snippet 1 #######
  68.  
  69. (mycommon) {
  70. ext .html .htm .php
  71. root "C:\Users\username\Documents\caddy" # Change path & syntax for your OS or your preferred location!
  72. gzip
  73.  
  74. header / {
  75. X-Content-Type-Options nosniff
  76. X-XSS-Protection "1; mode=block"
  77. Strict-Transport-Security "max-age=31536000;"
  78. }
  79. }
  80.  
  81. ####### Snippet 2 #######
  82.  
  83. (mylocations) {
  84.  
  85. # You can normally use "127.0.0.1", use the appropriate "IP address" if your running the web server/apps on different machines
  86.  
  87. proxy /sabnzb 192.168.1.103:8080 { # https://sabnzbd.org/
  88. transparent
  89. }
  90.  
  91. #proxy /htpc 127.0.0.1:8085 { # http://htpc.io/
  92. # transparent
  93. #}
  94.  
  95. proxy /headphones 192.168.1.103:8181 { # https://github.com/rembo10/headphones
  96. transparent
  97. }
  98.  
  99. proxy /jackett 127.0.0.1:9117 { # https://github.com/
  100. transparent
  101. }
  102.  
  103. #proxy /mylar 127.0.0.1:8090 { # https://github.com/evilhero/mylar
  104. # transparent
  105. #}
  106.  
  107. proxy /lazylibrarian 127.0.0.1:5299 { # https://github.com/DobyTang/LazyLibrarian
  108. transparent
  109. }
  110.  
  111. #proxy /emby 127.0.0.1:8096 { # https://emby.media/
  112. # transparent
  113. #}
  114.  
  115. proxy /sonarr 127.0.0.1:8989 { # https://sonarr.tv/
  116. transparent
  117. }
  118.  
  119. # Headphones uses port 8181 so make sure there's no conflict!
  120.  
  121. proxy /tautulli 192.168.1.105:8181 { # https://github.com/Tautulli/Tautulli
  122. #header_upstream X-Forwarded-Host {host}
  123. transparent
  124. }
  125.  
  126. #proxy /nzbget 127.0.0.1:6789 { # http://nzbget.net/
  127. # transparent
  128. #}
  129.  
  130. #proxy /couch 127.0.0.1:5050 { # https://couchpota.to/
  131. # transparent
  132. #}
  133.  
  134. #proxy /nzbhydra 127.0.0.1:5075 { # https://github.com/theotherp/nzbhydra
  135. # transparent
  136. #}
  137.  
  138. proxy /nzbhydra2 192.168.1.103:5076 { # https://github.com/theotherp/nzbhydra2
  139. transparent
  140. }
  141.  
  142.  
  143. # New rewrite rule needed to load some of Ombi V3's assets
  144.  
  145. rewrite {
  146. r ^/dist
  147. to /ombi/{uri}
  148. }
  149.  
  150. proxy /ombi 127.0.0.1:5000 { # https://github.com/tidusjar/Ombi
  151. transparent
  152. }
  153.  
  154. # The rewrite makes sure all of glances sub directory calls are proxied from domain to host
  155.  
  156. #rewrite {
  157. # if {>Referer} has /glances
  158. # to /glances/{path}
  159. #}
  160.  
  161. #proxy /glances 127.0.0.1:61208 { # https://github.com/nicolargo/glances
  162. # without /glances
  163. # transparent
  164. #}
  165.  
  166. rewrite {
  167. if_op or
  168. if {>Referer} has /deluge
  169. if {>Referer} has /192.168.1.103/themes/css/
  170. if {>Referer} has /192.168.1.103/css/
  171. to /deluge/{path}
  172. }
  173.  
  174. # The code below gives you a tiny level of security requiring a username/password before Caddy will let you connect to it
  175.  
  176. #basicauth /deluge test Password
  177.  
  178. proxy /deluge http://192.168.1.103:8112 { # http://deluge-torrent.org/
  179. without /deluge
  180. transparent
  181. header_upstream X-Forwarded-Host {host}
  182. }
  183.  
  184. #proxy /watcher 127.0.0.1:9090 { # https://github.com/nosmokingbandit/Watcher3
  185. # transparent
  186. #}
  187.  
  188. proxy /radarr 127.0.0.1:7878 { # https://github.com/Radarr/Radarr
  189. transparent
  190. }
  191.  
  192. proxy /subsonic 127.0.0.1:4040 { # https://
  193. transparent
  194. }
  195.  
  196. proxy /ubooquity 127.0.0.1:2202 { # https://
  197. transparent
  198. }
  199.  
  200. proxy /ubooquity/admin 127.0.0.1:2203 { # https://
  201. transparent
  202. }
  203.  
  204. #proxy /organizr http://192.168.1.100:80 { # https://github.com/causefx/Organizr
  205. #without /organizr
  206. #transparent
  207. #header_upstream X-Forwarded-Host {host}
  208. #}
  209.  
  210. proxy /monitorr/ 192.168.1.100:8080/monitorr/ { # https://github.com/Monitorr/Monitorr/
  211. transparent
  212. }
  213.  
  214. # The code below will proxy PHP requests
  215.  
  216. fastcgi / 127.0.0.1:9000 php
  217.  
  218. }
  219.  
  220. ####################################################################################
  221. # web domain server block
  222. ####################################################################################
  223.  
  224. organizr.mydomain.net {
  225.  
  226. tls username@mydomain.net # Email for Let's Encrypt Verification
  227.  
  228. # New log directive syntax for v0.10.x
  229. log "C:\Users\username\Documents\caddy\logs\access.log" { # Change path syntax for your OS or your preferred location!
  230. rotate_size 1 # Rotate after 1 MB
  231. rotate_age 7 # Keep log files for 7 days
  232. rotate_keep 2 # Keep at most 2 log files
  233. }
  234.  
  235. errors "C:\Users\username\Documents\caddy\logs\error.log" { # Change path syntax for your OS or your preferred location!
  236. rotate_size 1 # Set max size 1 MB
  237. rotate_age 7 # Keep log files for 7 days
  238. rotate_keep 2 # Keep at most 2 log files
  239. }
  240.  
  241. on startup "C:\Users\username\Documents\caddy\php\php-cgi" -b 127.0.0.1:9000 -c "C:\Users\username\Documents\caddy\php\php.ini" & # Change path/s to your PHP folder location
  242.  
  243. import mycommon # Import code snippet 1 defined above
  244. import mylocations # Import code snippet 2 defined above
  245.  
  246. }
  247.  
  248. ####################################################################################
  249. # localhost or Machine server block
  250. ####################################################################################
  251.  
  252. http://localhost http://192.168.1.103 http://127.0.0.1 http://abc.books http://abc.movies http://abc.tv http://abc.torrents http://abc.music http://abc.searchers http://abc.nzbs http://abc.requests http://abc.downloads http://abc.jukebox http://abc.plexpy3 http://abc.library http://abc.libraryadmin http://abc.plex http://organizr.abc.portal http://abc.services
  253. {
  254.  
  255. import mycommon # Import code snippet 1 defined above
  256. import mylocations # Import code snippet 2 defined above
  257.  
  258. }
  259.  
  260. ####################################################################################
  261. # localhost fusion subdomain code block
  262. ####################################################################################
  263.  
  264. http://fusion.abc.services
  265.  
  266. gzip
  267.  
  268. proxy / 192.168.1.103:20604 {
  269. transparent
  270. }
  271. }
  272.  
  273. ####################################################################################
  274. # Plex subdomain code block
  275. ####################################################################################
  276.  
  277. plex.mydomain.net {
  278.  
  279. gzip
  280.  
  281. #Separate log file for Plex server
  282.  
  283. log "C:\Users\username\Documents\caddy\logs\plexaccess.log" {
  284. rotate_size 1 # Rotate after 1 MB
  285. rotate_age 7 # Keep log files for 7 days
  286. rotate_keep 2 # Keep at most 2 log files
  287. }
  288.  
  289. errors "C:\Users\username\Documents\caddy\logs\plexerror.log" {
  290. rotate_size 1 # Set max size 1 MB
  291. rotate_age 7 # Keep log files for 7 days
  292. rotate_keep 2 # Keep at most 2 log files
  293. }
  294.  
  295. proxy / 192.168.1.105:32400 {
  296. transparent
  297. }
  298.  
  299. }
  300.  
  301. ####################################################################################
  302. # Organizr subdomain code block example
  303. ####################################################################################
  304.  
  305. # Remember to disable/remove the base url settings from within the app! Else "/sonarr" will be appended to the domain and will
  306. # defeat the purpose of using a subdomain. (e.g. sonarr.domain.com will become "sonarr.domain.com/sonarr")
  307.  
  308. organizr1.mydomain.net {
  309.  
  310. gzip
  311.  
  312. log "C:\Users\username\Documents\caddy\logs\organizraccess.log" {
  313. rotate_size 1 # Rotate after 1 MB
  314. rotate_age 7 # Keep log files for 7 days
  315. rotate_keep 2 # Keep at most 2 log files
  316. }
  317.  
  318. errors "C:\Users\username\Documents\caddy\logs\organizrerror.log" {
  319. rotate_size 1 # Set max size 1 MB
  320. rotate_age 7 # Keep log files for 7 days
  321. rotate_keep 2 # Keep at most 2 log files
  322. }
  323.  
  324. proxy / 192.168.1.100:80 {
  325. transparent
  326. }
  327. }
  328.  
  329. ####################################################################################
  330. # Monitorr subdomain code block example
  331. ####################################################################################
  332.  
  333. # Remember to disable/remove the base url settings from within the app! Else "/sonarr" will be appended to the domain and will
  334. # defeat the purpose of using a subdomain. (e.g. sonarr.domain.com will become "sonarr.domain.com/sonarr")
  335.  
  336. monitorr.mydomain.net {
  337.  
  338. gzip
  339.  
  340. log "C:\Users\username\Documents\caddy\logs\monitorraccess.log" {
  341. rotate_size 1 # Rotate after 1 MB
  342. rotate_age 7 # Keep log files for 7 days
  343. rotate_keep 2 # Keep at most 2 log files
  344. }
  345.  
  346. errors "C:\Users\username\Documents\caddy\logs\monitorrerror.log" {
  347. rotate_size 1 # Set max size 1 MB
  348. rotate_age 7 # Keep log files for 7 days
  349. rotate_keep 2 # Keep at most 2 log files
  350. }
  351.  
  352. proxy /monitorr 192.168.1.100:8080/monitorr/ { # https://github.com/Monitorr/Monitorr/
  353. transparent
  354. }
  355. }
  356.  
  357. ####################################################################################
  358. # FireDaemon Fusion subdomain code block example
  359. ####################################################################################
  360.  
  361. # Remember to disable/remove the base url settings from within the app! Else "/sonarr" will be appended to the domain and will
  362. # defeat the purpose of using a subdomain. (e.g. sonarr.domain.com will become "sonarr.domain.com/sonarr")
  363.  
  364. fusion.mydomain.net {
  365.  
  366. gzip
  367.  
  368. log "C:\Users\username\Documents\caddy\logs\fusionaccess.log" {
  369. rotate_size 1 # Rotate after 1 MB
  370. rotate_age 7 # Keep log files for 7 days
  371. rotate_keep 2 # Keep at most 2 log files
  372. }
  373.  
  374. errors "C:\Users\username\Documents\caddy\logs\fusionerror.log" {
  375. rotate_size 1 # Set max size 1 MB
  376. rotate_age 7 # Keep log files for 7 days
  377. rotate_keep 2 # Keep at most 2 log files
  378. }
  379. proxy / 192.168.1.103:20604 {
  380. transparent
  381. }
  382. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement