我正在尝试配置现有的NGINX以与CentOS上的Gitlab omnibus配合使用。我目前安装了另一个使用127.0.0.1:3838的应用程序(App A)。到目前为止,我有NGINX设置,以便进入我的网站IP 12.345.678.910,我能够重定向到App A.我想设置Gitlab,以便当我转到12.345.678.910/gitlab时,它将我重定向到Gitlab。我的想法是在http://127.0.0.1:8081上运行Gitlab,并让NGINX将12.345.678.910/gitlab重定向到localhost:8081。
我已按照这些链接寻求帮助:
https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server
Forwarding to GitLab Subdomain with Existing Nginx Installation
编辑/etc/gitlab/gitlab.rb
external_url = 'http://127.0.0.1:8081'
nginx['enable'] = false
web_server['external_users'] = ['nginx']
新配置文件/ etc / nginx / sites-enabled / gitlab
upstream gitlab-workhorse {
server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}
server {
listen 0.0.0.0:8081;
listen [::]:8081;
server_name localhost;
server_tokens off;
root /opt/gitlab/embedded/service/gitlab-rails/public;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
client_max_body_size 0;
gzip off;
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_pass http://gitlab-workhorse;
}
}
已添加到/etc/nginx/conf.d/default.conf:
server {
listen 80 default_server;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /gitlab {
proxy_pass http://127.0.0.1:8081;
}
我已将'nginx'添加到gitlab-www组。跑nginx restart和gitlab重新配置命令。
sudo usermod -aG gitlab-www nginx
sudo service nginx restart
sudo gitlab-ctl reconfigure && gitlab-ctl restart
我在上面的链接中为每个评论安装了Passenger,但这并没有解决问题。因此,当我转到12.345.678.910/gitlab时,我收到了一个Page Not Found错误。
我仍然是这一切的新手,我们将不胜感激。