summaryrefslogtreecommitdiff
path: root/arch-mirror.home.eckner.net.conf
blob: b79eef10abf1f7e2124118a73819b8af0d2ba9a9 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
resolver 192.168.0.18 192.168.0.13;

server {
    listen [::]:80;
    listen 80;

    server_name *.arch-mirror.home.eckner.net;
    root        /srv/http/arch-mirror;
    autoindex   on;
}

server {
    listen [::]:80;
    listen 80;
    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/arch-mirror.home.eckner.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/arch-mirror.home.eckner.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    server_name arch-mirror.home.eckner.net;
    root        /srv/http/arch-mirror;
    autoindex   on;

    # Requests for package db, signature files and files db should redirect upstream without caching
    location ~ /archlinuxewe/os/[^/]+/[^/]+\.(db|sig|files)$ {
        proxy_pass http://mirrorsewe$request_uri;
    }
    location ~ /releng/os/x86_64/([^/]+\.(db|sig|files))$ {
        proxy_pass http://mirrors32/x86_64/releng/$1;
    }

    location ~ ^/([^/]+)/archlinuxewe/([^/]+\.(db|sig|files))$ {
        proxy_pass http://mirrorsewe/archlinuxewe/os/$1/$2;
    }
    location ~ /x86_64/[^/]+\.(db|sig|files)$ {
        proxy_pass http://mirrors$request_uri;
    }
    location ~ /(i[46]86|pentium4)/[^/]+/[^/]+\.(db|sig|files)$ {
        proxy_pass http://mirrors32$request_uri;
    }
    location ~ /(arm(|v6h|v7h)|aarch64)/[^/]+/[^/]+\.(db|sig|files)$ {
        proxy_pass http://mirrorsarm$request_uri;
    }

    # Requests for actual packages should be served directly from cache if available.
    #   If not available, retrieve and save the package from an upstream mirror.
    location ~ /archlinuxewe/os/[^/]+/[^/]+\.tar\.(xz|zst)$ {
        try_files $uri @caches @pkg_mirrorewe;
    }
    location ~ ^/([^/]+)/archlinuxewe/([^/]+\.tar\.(xz|zst))$ {
        try_files /archlinuxewe/os/$1/$2 @caches_reordered @pkg_mirrorewe_reordered;
    }
    location ~ ^/(releng)/os/([^/]+)/([^/]+\.tar\.(xz|zst))$ {
        try_files $uri @caches @pkg_mirror32_reordered;
    }

    location ~ /x86_64/[^/]+\.tar\.(xz|zst)$ {
        try_files $uri @caches @pkg_mirror;
    }
    location ~ /(i[46]86|pentium4)/[^/]+/[^/]+\.tar\.(xz|zst)$ {
        try_files $uri @caches @pkg_mirror32;
    }
    location ~ /(arm(v[67]h)?|aarch64)/[^/]+/[^/]+\.tar\.(xz|zst)$ {
        try_files $uri @caches @pkg_mirrorarm;
    }

    # Retrieve package from cache of another local mirror
    location @caches {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://caches$request_uri;
    }
    location @caches_reordered {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://caches/$2/$1/$3;
    }

    # Retrieve package from upstream mirrors and cache for future requests
    location @pkg_mirror {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://mirrors$request_uri;
    }
    location @pkg_mirror32 {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://mirrors32$request_uri;
    }
    location @pkg_mirror32_reordered {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://mirrors32/$2/$1/$3;
    }
    location @pkg_mirrorarm {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://mirrorsarm$request_uri;
    }
    location @pkg_mirrorewe {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://mirrorsewe$request_uri;
    }
    location @pkg_mirrorewe_reordered {
        proxy_store    on;
        proxy_redirect off;
        proxy_store_access  user:rw group:rw all:r;
        proxy_next_upstream error timeout http_404;
        proxy_pass          http://mirrorsewe/archlinuxewe/os/$1/$2;
    }

}

# other local mirrors
upstream caches {
    server 1.arch.eckner.net:80;
    server 2.arch.eckner.net:80;
}

# Upstream Arch Linux Mirrors
# - Configure as many backend mirrors as you want in the blocks below
# - Servers are used in a round-robin fashion by nginx
# - Add "backup" if you want to only use the mirror upon failure of the other mirrors
# - Use separate mirror server blocks to be able to use mirrors that have different paths to the package repos
upstream mirrors {
    server 127.0.0.42:8001;
    server 127.0.0.42:8002 backup;
    server 127.0.0.42:8003 backup;
    server 127.0.0.42:8004 backup;
}
upstream mirrors32 {
    server 127.0.0.43:8001;
}
upstream mirrorsarm {
    server 127.0.0.44:8001;
    server 127.0.0.44:8002;
    server 127.0.0.44:8003;
    server 127.0.0.44:8004;
    server 127.0.0.44:8005;
    server 127.0.0.44:8006;
    server 127.0.0.44:8007;
    server 127.0.0.44:8008;
    server 127.0.0.44:8009;
    server 127.0.0.44:8010;
    server 127.0.0.44:8011;
    server 127.0.0.44:8012;
    server 127.0.0.44:8013;
    server 127.0.0.44:8014;
    server 127.0.0.44:8015;
    server 127.0.0.44:8016;
    server 127.0.0.44:8017;
    server 127.0.0.44:8018;
    server 127.0.0.44:8019;
    server 127.0.0.44:8020;
}
upstream mirrorsewe {
    server 127.0.0.45:8001;
}

# If you want to use an official mirror from /etc/pacman.d/mirrorlist like
# http://mirror.domain.example/path/to/repo/$repo/os/$arch
#
# the proxy_pass directive should look like this
# proxy_pass http://mirror.domain.example/path/to/repo$request_uri;
#
# Notice that $request_uri replaces the /$repo/os/$arch part of
# the mirror address. See more examples below.

server {
    listen      127.0.0.42:8001;
    location / {
        proxy_pass       https://ftp.gwdg.de/pub/linux/archlinux$request_uri;
    }
}

server {
    listen      127.0.0.42:8002;
    location / {
        proxy_pass       https://mirror.f4st.host/archlinux$request_uri;
    }
}

server {
    listen      127.0.0.42:8003;
    location / {
        proxy_pass       https://ftp.spline.inf.fu-berlin.de/mirrors/archlinux$request_uri;
    }
}

server {
    listen      127.0.0.42:8004;
    location / {
        proxy_pass       https://mirror.pkgbuild.com$request_uri;
    }
}

server {
    listen      127.0.0.43:8001;
    location / {
        proxy_pass       https://mirror.archlinux32.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8002
    location / {
        proxy_pass       http://au.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8003
    location / {
        proxy_pass       http://br.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8004
    location / {
        proxy_pass       http://dk.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8005
    location / {
        proxy_pass       http://de3.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8006
    location / {
        proxy_pass       http://de.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8007
    location / {
        proxy_pass       http://de4.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8008
    location / {
        proxy_pass       http://eu.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8009
    location / {
        proxy_pass       http://de5.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8010
    location / {
        proxy_pass       http://gr.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8011
    location / {
        proxy_pass       http://hu.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8012
    location / {
        proxy_pass       http://pt.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8013
    location / {
        proxy_pass       http://sg.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8014
    location / {
        proxy_pass       http://za.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8015
    location / {
        proxy_pass       http://tw.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8016
    location / {
        proxy_pass       http://ca.us.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8017
    location / {
        proxy_pass       http://fl.us.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8018
    location / {
        proxy_pass       http://il.us.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8019
    location / {
        proxy_pass       http://nj.us.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8020
    location / {
        proxy_pass       http://vn.mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.44:8001;
    location / {
        proxy_pass       http://mirror.archlinuxarm.org$request_uri;
    }
}

server {
    listen      127.0.0.45:8001;
    location / {
        proxy_pass       https://arch.eckner.net$request_uri;
    }
}