Gitlab设置Go私库

Nginx 配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
server {
listen 80;
listen 443 ssl http2;
server_name your.domain;

ssl_certificate /etc/nginx/certs/your.domain.crt;
ssl_certificate_key /etc/nginx/certs/your.domain.key;

access_log /var/log/nginx/gitlab.nginx.log combined;
error_log /var/log/nginx/gitlab.error.log error;
index index.html index.htm index.php;
if ($args ~* "^go-get=1") {
set $condition goget;
}
if ($uri ~ ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$) {
set $condition "${condition}path";
}
if ($condition = gogetpath) {
return 200 "<!DOCTYPE html><html><head><meta content='your.domain$uri git ssh://git@your.domain:port$uri.git' name='go-import'></head></html>";
}
location / {
proxy_pass http://ip:port;
}
}

本文作者:Jormin
本文地址https://blog.lerzen.com/gitlab设置go私库/
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

----- 到这结束咯 感谢您的阅读 -----