0%

elixir hexpm 镜像搭建

搭建一个https://repo.hex.pm镜像站,用于加速mix deps.get

方式1:子目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
## https://xxx/hexpm/
rewrite ^/hexpm$ /hexpm/ permanent;
location ~ "^/hexpm/(.*)" {
proxy_request_buffering off;

proxy_buffer_size 64k;
proxy_buffers 32 64k;
proxy_busy_buffers_size 128k;

proxy_http_version 1.1;
proxy_connect_timeout 10s;
proxy_read_timeout 10s;
proxy_socket_keepalive on;

proxy_ssl_server_name on;
proxy_ssl_name repo.hex.pm;
proxy_ssl_verify off;
proxy_set_header Host repo.hex.pm;
proxy_pass https://repo.hex.pm/$1;
}

方式2:域名

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
## https://xxxxx
server {
listen 443 ssl http2;
server_name xxxxx;
root /data/github;

client_max_body_size 2G;

error_page 497 https://$host$request_uri;

location / {
proxy_request_buffering off;

proxy_buffer_size 64k;
proxy_buffers 32 64k;
proxy_busy_buffers_size 128k;

proxy_http_version 1.1;
proxy_connect_timeout 10s;
proxy_read_timeout 10s;
proxy_socket_keepalive on;

proxy_ssl_server_name on;
proxy_ssl_name repo.hex.pm;
proxy_ssl_verify off;
proxy_set_header Host repo.hex.pm;
proxy_pass https://repo.hex.pm;
}
## 其他配置
## ...
}