Nginx gitlab_ci重定向到gitlab
我刚刚用这个安装了nginx(一步一步地安装,一切都很好) 我在同一台机器(gitlab.loc)上运行了一个gitlab安装。 gitlab_ci使用的域名是“gitlab ci.loc” 我正在使用为nginx提供的配置(刚刚将服务器名称更改为gitlab ci.loc) 问题:当我尝试在浏览器中打开gitlab-ci.loc时,它会向我提供gitlab页面,就像我调用gitlab.loc而不是gitlab-ci.loc一样。 浏览器地址是schows gitlab-ci.loc,所以我想我在nginx配置中做了一些工作 gitlab_ci的nginx配置Nginx gitlab_ci重定向到gitlab,nginx,gitlab,Nginx,Gitlab,我刚刚用这个安装了nginx(一步一步地安装,一切都很好) 我在同一台机器(gitlab.loc)上运行了一个gitlab安装。 gitlab_ci使用的域名是“gitlab ci.loc” 我正在使用为nginx提供的配置(刚刚将服务器名称更改为gitlab ci.loc) 问题:当我尝试在浏览器中打开gitlab-ci.loc时,它会向我提供gitlab页面,就像我调用gitlab.loc而不是gitlab-ci.loc一样。 浏览器地址是schows gitlab-ci.loc,所以我想我
# GITLAB CI
# Maintainer: @randx
# App Version: 2.0
upstream gitlab_ci {
server unix:/home/gitlab_ci/gitlab-ci/tmp/sockets/gitlab-ci.socket;
}
server {
listen *:80 default_server; # e.g., listen 192.168.1.1:80;
server_name gitlab-ci.loc; # e.g., server_name source.example.com;
root /home/gitlab_ci/gitlab-ci/public;
access_log /var/log/nginx/gitlab_ci_access.log;
error_log /var/log/nginx/gitlab_ci_error.log;
location / {
try_files $uri $uri/index.html $uri.html @gitlab_ci;
}
location @gitlab_ci {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://gitlab_ci;
}
# adjust this to match the largest build log your runners might submit,
# set to 0 to disable limit
client_max_body_size 10m;
}
gitlab的nginx配置
#GITLAB
#维护者:@randx
#应用程序版本:5.0
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen *:80 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name gitlab.loc; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
# Set value of client_max_body_size to at least the value of git.max_size in gitlab.yml
client_max_body_size 5m;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gitlab;
}
}
config/application.yml
defaults: &defaults
allowed_gitlab_urls:
- 'https://dev.gitlab.org/'
- 'https://staging.gitlab.org/'
## Gitlab CI settings
gitlab_ci:
## Web server settings
host: gitlab-ci.loc
port: 80
https: false
## Email settings
# Email address used in the "From" field in mails sent by GitLab-CI
email_from: gitlab-ci@localhost
# Email address of your support contact (default: same as email_from)
support_email: support@localhost
# Send emails for all failing builds
# all_broken_builds: true
# Add committer to recipients list
# add_committer: true
gravatar:
enabled: true
plain_url: "http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm"
ssl_url: "https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm"
development:
<<: *defaults
neat_setting: 800
test:
<<: *defaults
allowed_gitlab_urls:
- 'http://demo.gitlab.com/'
production:
<<: *defaults
defaults:&defaults
允许的\u gitlab\u URL:
- 'https://dev.gitlab.org/'
- 'https://staging.gitlab.org/'
##Gitlab CI设置
gitlab_ci:
##Web服务器设置
主持人:gitlab-ci.loc
港口:80
https:false
##电子邮件设置
#GitLab CI发送的邮件中“发件人”字段中使用的电子邮件地址
电子邮件地址:gitlab-ci@localhost
#支持联系人的电子邮件地址(默认值:与电子邮件地址相同)
支持电子邮件:support@localhost
#为所有失败的构建发送电子邮件
#所有损坏的构建:正确
#将提交者添加到收件人列表
#添加提交人:true
格拉瓦塔:
已启用:true
普通url:“http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm“
ssl\u url:“https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm“
发展:
不能将两台服务器定义为默认\u服务器
。第二个将不会加载,第一个定义的将接管所有请求。将listen
中的一行更改为
listen *:80;
重新加载Nginx