I installed gitlab in behind nginx reverse proxy and it worked fine. Added the below configuration. Note that location path was changed.
upstream gitlab-workhorse {
server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}
server {
listen 0.0.0.0:80 default_server;
listen [::]:80 default_server;
server_name abcd.com;
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 debug;
location /gitlab {
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;
}
}
While testing gitlab, I deleted default file soft link from nginx sites-enabled.
I created the soft link again the configuration is as follows: Note that default_server is removed her and location path is "/"
server {
listen 0.0.0.0:80;
listen [::]:80;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
access_log /var/log/nginx/default_access.log;
error_log /var/log/nginx/default_error.log debug;
location / {
try_files $uri $uri/ =404;
}
}
Now while accessing my VM ip http://x.y.z.a, I am getting "403 Forbidden" error in the browser. However gitlab still working. How to get both the sites working listening on port 80 but with different context of location?