gitlab基本配置
来源:互联网 发布:全球地名数据库 编辑:程序博客网 时间:2024/06/03 21:46
注:是否配置https、相对路径/gitlab根据实际情况
1、gitlab.yml
cd /home/git/gitlabvim config/gitlab.yml
编辑如下:
第32行
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host:domain
port: 443
https: ture
第47行
relative_url_root: /gitlab
2、unicorn.rb
cd /home/git/gitlab
执行如下命令查看CPU内核数
nproc
vim config/unicorn.rb
修改如下:
ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
worker_processes 4
3、resque.yml
cd /home/git/gitlab
vim config/resque.yml
修改如下:
production:
# Redis (single instance)
url: redis://:pass@host:6379/db
4、database.yml
cd /home/git/gitlab
vim config/database.yml
修改如下:
production:
adapter: mysql2
encoding: utf8
collation: utf8_general_ci
reconnect: false
database: db
pool: 10
username: un
password: "pass"
host: host
port: 3306
socket: /var/lib/mysql/mysql.sock
5、config.yml
vim /home/git/gitlab-shell/config.yml
修改如下:
user: git
gitlab_url: http://localhost:8080/gitlab/
http_settings:
self_signed_cert: false
repos_path: "/home/git/repositories/"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
bin: "/bin/redis-cli"
namespace: resque:gitlab
host: host
port: 6379
pass: pass
database: db
log_level: INFO
audit_usernames: false
6、gitlab
vim /etc/default/gitlab
gitlab_workhorse_options="-listenUmask 0 -listenNetwork tcp -listenAddr 127.0.0.1:8181 -authBackend http://127.0.0.1:8080/gitlab -authSocket $socket_path/gitlab.socket -documentRoot $app_root/public"
7、relative_url.rb修改相对路径
cp /home/git/gitlab/config/initializers/relative_url.rb.sample /home/git/gitlab/config/initializers/relative_url.rb
vim /home/git/gitlab/config/initializers/relative_url.rb
Rails.application.configure do
config.relative_url_root = "/gitlab"
end
8、修改nginx.conf
vim /etc/nginx/nginx.conf
server {
#listen 80 default_server;
#listen [::]:80 default_server;
#server_name _;
#root /usr/share/nginx/html;
# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;
#location / {
#}
#error_page 404 /404.html;
#location = /40x.html {
#}
#error_page 500 502 503 504 /50x.html;
# location = /50x.html {
#}
}
9、修改gitlab.conf
vim /etc/nginx/conf.d/gitlab.conf
修改为一下内容:
## GitLab
##
## Modified from nginx http version
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
## Modified from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
##
## Lines starting with two hashes (##) are comments with information.
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
##
##################################
## CONTRIBUTING ##
##################################
##
## If you change this file in a Merge Request, please also create
## a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
##
###################################
## configuration ##
###################################
##
## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab-workhorse {
server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
}
map $http_upgrade $connection_upgrade_gitlab {
default upgrade;
'' close;
}
map $http_upgrade $connection_upgrade_gitlab_ssl {
default upgrade;
'' close;
}
## Redirects all HTTP traffic to the HTTPS host
server {
## Either remove "default_server" from the listen line below,
## or delete the /etc/nginx/sites-enabled/default file. This will cause gitlab
## to be served if you visit any address that your server responds to, eg.
## the ip address of the server (http://x.x.x.x/)
listen 0.0.0.0:80 default_server;
#listen [::]:80 ipv6only=on default_server;
server_name domain; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
#return 301 https://$http_host$request_uri;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location = / {
rewrite ^ https://domain/gitlab redirect;
}
location /gitlab {
client_max_body_size 0;
gzip off;
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
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_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade_gitlab;
#proxy_pass http://gitlab-workhorse;
proxy_pass http://127.0.0.1:8181/gitlab;
}
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
root /home/git/gitlab/public;
internal;
}
}
## HTTPS host
server {
listen 0.0.0.0:443 ssl default_server;
#listen [::]:443 ipv6only=on ssl default_server;
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
## Strong SSL Security
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
ssl on;
ssl_certificate /etc/nginx/ssl/xxx.cer;
ssl_certificate_key /etc/nginx/ssl/xxx.key;
# GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
## See app/controllers/application_controller.rb for headers set
## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
## Replace with your ssl_trusted_certificate. For more info see:
## - https://medium.com/devops-programming/4445f4862461
## - https://www.ruby-forum.com/topic/4419319
## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
# ssl_stapling on;
# ssl_stapling_verify on;
# ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
# resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
# resolver_timeout 5s;
## [Optional] Generate a stronger DHE parameter:
## sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
##
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
## [Optional] Enable HTTP Strict Transport Security
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location = / {
rewrite ^ /gitlab redirect;
}
location /gitlab {
client_max_body_size 0;
gzip off;
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade_gitlab_ssl;
#proxy_pass http://gitlab-workhorse;
proxy_pass http://127.0.0.1:8181/gitlab;
}
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
root /home/git/gitlab/public;
internal;
}
}
0 0
- gitlab基本配置
- Gitlab配置
- GitLab及TortoiseGit的基本配置及使用方法
- 笔记:gitlab-ci 可持续集成(3) runner 基本配置
- CI(持续集成)之Jenkins+Gitlab的基本配置
- gitlab基本使用
- GitLab 基本使用说明
- gitlab基本一些基本操作
- Gitlab配置ssh连接
- Gitlab配置ssh连接
- 安装配置gitlab
- windows下配置Gitlab
- Eclipse+GitLab图文配置
- GitLab 的安装配置
- gitlab配置ssh key
- GitLab CE安装配置
- gitlab客户端ssh配置
- GitLab配置HTTPS
- android DES加密解密
- Android PopupWindow系列 (一) —— popupWindow基本使用方略
- 几款常用的接口测试工具的对比
- maven项目导到eclipse不识别为java项目
- c++第六次实验
- gitlab基本配置
- 如何让自己项目在Android studio中以compile被使用(jitpack.io)
- Spring Bean的生命周期
- INSTALL_FAILED_CONFLICTING_PROVIDER安装失败错误
- zookeeper 集群部署
- 企业做响应式网站的好处
- struts2 最新漏洞 S2-016、S2-017修补方案
- 京东首页
- 如何分析源代码