blob: 24f332023082ae8232c5e01fee9e4a4d37dcc897 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Author: <Dick Hollenbeck> dick@softplc.com
# Configuration file for nginx. Nginx works as a nice cache-ing proxy for
# the github footprint repos in a local nginx instance.
# In my case I also added a small RAM disk on a linux server to hold the cache.
# This line in /etc/fstab adds my RAM disk, this is 10 mbytes but 5mb would
# probably suffice:
none /var/cache/nginx tmpfs size=10m
# I then set my KIGITHUB environment variable to
# export KIGITHUB=http://my_server:54321/KiCad
# Note that http is used between kicad and nginx, not https. However nginx uses
# https when refreshing from github. http is faster than https.
# You can run nginx either on your local machine, or on a server on your network,
# or a server on the Internet. In my case I run it on my network. I imagine
# that even a Raspery Pi would act as a decent caching server so long as you
# install nginx and give the machine Internet access.
worker_processes 2;
events {
worker_connections 1024;
}
http {
proxy_cache_path /var/cache/nginx keys_zone=cache_zone:10m;
server {
# nginx will listen on this port:
listen 54321;
proxy_cache cache_zone;
# hold the stuff for one week, then mark it as out of date which will
# cause it to be reloaded from github.
proxy_cache_valid 1w;
location /KiCad/ {
rewrite /KiCad/(.+) /KiCad/$1/zip/master break;
# Skip past the redirect issued by https://github.com
proxy_pass https://codeload.github.com;
proxy_set_header Proxy-Connection "Keep-Alive";
proxy_ignore_headers "Set-Cookie";
proxy_ignore_headers "Cache-Control";
proxy_ignore_headers "Expires";
proxy_cache_bypass $http_secret_header;
add_header X-Cache-Status $upstream_cache_status;
# This line causes github.com to return a "502 Bad Gateway Error"
# so do not include it:
# proxy_set_header Host $http_host;
}
}
}
|