mirror of
https://github.com/ZJDoc/GitGuide.git
synced 2026-07-29 15:20:25 +08:00
docs(platform): add
This commit is contained in:
52
docs/platform/gitlab-nginx反向代理.md
Normal file
52
docs/platform/gitlab-nginx反向代理.md
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
# Nginx反向代理
|
||||
|
||||
当前`gitlab`登录路径是`localhost:8080`
|
||||
|
||||
```
|
||||
$ curl localhost:8800
|
||||
<html><body>You are being <a href="http://localhost:8800/users/sign_in">redirected</a>.</body></html>
|
||||
```
|
||||
|
||||
地址会跳转到`http://localhost:8800/users/sign_i`,下面通过反向代理简化登录地址
|
||||
|
||||
## 调整gitlab登录地址
|
||||
|
||||
修改`gitlab`配置文件`/etc/gitlab/gitlab.rb`,修改`external_url`访问路径
|
||||
|
||||
```
|
||||
external_url 'http://localhost:8800/gitlabs/'
|
||||
```
|
||||
|
||||
更新`gitlab`配置
|
||||
|
||||
```
|
||||
$ gitlab-ctl reconfigure
|
||||
$ gitlab-ctl restart
|
||||
```
|
||||
|
||||
## nginx配置
|
||||
|
||||
修改`nginx`配置文件`/etc/nginx/conf.d/default.conf`,新增`location`
|
||||
|
||||
```
|
||||
$ cat gitlab.conf
|
||||
server {
|
||||
...
|
||||
...
|
||||
location /gitlabs/ {
|
||||
proxy_pass http://localhost:8800;
|
||||
}
|
||||
...
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
刷新`nginx`
|
||||
|
||||
```
|
||||
$ sudo nginx -t
|
||||
$ sudo nginx -s reload
|
||||
```
|
||||
|
||||
之后输入`localhost/gitlabs/`即可登录`gitlab`
|
||||
Reference in New Issue
Block a user