I have installed Nginx Proxy Manager (as a Docker image) on 192.168.1.124 and added my GitLab server located at 192.168.1.186. When I set external_url in the gitlab.rb file to http://192.168.1.186, I can access my GitLab server at git.payhas.com. However, when I change external_url in gitlab.rb to https://git.payhas.com, it shows 404 Not Found.
Here is my /etc/nginx/sites-available/default conf file (on 192.168.1.186):
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; } }Here is my /etc/nginx/sites-available/gitlab conf file (on 192.168.1.186) (from official page: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/support/nginx/gitlab):
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; } log_format gitlab_access '$remote_addr - $remote_user [$time_local] "$request_method $gitlab_filtered_request_uri $server_protocol" $status $body_bytes_sent "$gitlab_filtered_http_referer" "$http_user_agent"'; map $request_uri $gitlab_temp_request_uri_1 { default $request_uri; ~(?i)^(?<start>.)(?<temp>[?&]private[-_]token)=[^&](?<rest>.*)$ "$start$temp=[FILTERED]$rest"; } map $gitlab_temp_request_uri_1 $gitlab_temp_request_uri_2 { default $gitlab_temp_request_uri_1; ~(?i)^(?<start>.)(?<temp>[?&]authenticity[-_]token)=[^&](?<rest>.*)$ "$start$temp=[FILTERED]$rest"; } map $gitlab_temp_request_uri_2 $gitlab_filtered_request_uri { default $gitlab_temp_request_uri_2; ~(?i)^(?<start>.)(?<temp>[?&]feed[-_]token)=[^&](?<rest>.*)$ "$start$temp=[FILTERED]$rest"; } map $http_referer $gitlab_filtered_http_referer { default $http_referer; ~^(?<temp>.*)? $temp; } server { listen 0.0.0.0:80; listen [::]:80; server_name git.payhas.com; server_tokens off; real_ip_header X-Real-IP; real_ip_recursive off; access_log /var/log/nginx/gitlab_access.log gitlab_access; 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_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade_gitlab; proxy_pass http://gitlab-workhorse; } 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; } }Set inside gitlab.rb file:
external_url 'https://git.payhas.com' nginx['enable'] = false web_server['external_users'] = ['www-data'] gitlab_rails['trusted_proxies'] = [ '192.168.1.124/24' ] nginx['listen_port'] = 80 nginx['listen_https'] = falseAlso added www-data user to the gitlab-www group in 192.168.1.186.
Set in nginx proxy manager on 192.168.1.124:
domain name: git.payhas.com scheme: http Forward IP: 192.168.1.186 Forward Port: 80
All of them are running in ubuntu 22.04 server version:
Nginx proxy manager (as a docker image in 192.168.1.124) Gitlab CE (runs on a plain ubuntu in 192.168.1.186) Gitlab-runner (runs on a plain ubuntu in 192.168.1.165)
I tried according to documentation at https://docs.gitlab.com/omnibus/settings/nginx.html#use-a-non-bundled-web-server. However, I still face issues when I try to browse using git.payhas.com. It is perfectly works when I browser using its IP instead.
Add a comment
|
1 Answer
Since I couldn't find any proper solution, I decided to reinstall my entire gitlab ce server and set domain name instead of IP, everything went well. Also, I indicated http, then I had required ssl for my new domain through proxy manager node. It is quite simple. I messed it up at first and wasted my entire week)