I am trying to configure an existing NGINX to work with Gitlab omnibus on CentOS. I currently have another application (App A) installed that uses 127.0.0.1:3838. So far I have NGINX setup so that going to my site IP 12.345.678.910, I am able to redirect to App A. I would like to setup Gitlab so that when I go to 12.345.678.910/gitlab, it redirects me to Gitlab. The idea is to run Gitlab on http://127.0.0.1:8081, and have NGINX redirect 12.345.678.910/gitlab to localhost:8081.
I've followed these links for help:
https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server.
Forwarding 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've added 'nginx' to gitlab-www group. Ran the 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 solve the issue. So when I go to 12.345.678.910/gitlab I get a Page Not Found error.
I am still new to all this and any help would be appreciated.