Configuring Gitlab and NGINX
I am trying to set up an existing NGINX to work with Gitlab omnibus on CentOS. I currently have another app installed (App A) that uses 127.0.0.1:3838. As long as I have NGINX setup so that by going to my site IP 12.345.678.910 I can redirect Application A. I would like to configure Gitlab so that when I go to 12.345.678.910/gitlab it redirects me to Gitlab. The idea is to start Gitlab at http://127.0.0.1:8081 and redirect NGINX 12.345.678.910/gitlab to localhost: 8081.
I followed these links for help:
https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server .
Redirect to GitLab subdomain with existing Nginx installation
Edited / etc / gitlab / gitlab.rb
external_url = 'http://127.0.0.1:8081'
nginx['enable'] = false
web_server['external_users'] = ['nginx']
New config file / 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;
}
}
Added to /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;
}
I added "nginx" to the gitlab-www group. Run nginx restart and gitlab reconfigure commands.
sudo usermod -aG gitlab-www nginx
sudo service nginx restart
sudo gitlab-ctl reconfigure && gitlab-ctl restart
I installed Passenger per comment in the link above, but that didn't fix the problem. So when I go to 12.345.678.910/gitlab I get a page not found error.
I am still new to all of this and any help would be appreciated.
No one has answered this question yet
See similar questions:
or similar: