DS87
DS87

Reputation: 602

Run another website on a standard gitlab installation

I do not know whether I am to dump to find or search for a solution or if it is not possible at all. A time ago, I did the standard Gitlab installation (https://about.gitlab.com/installation/#ubuntu). Gitlab is running fine so far.

Now, I want to run a further Website beside the Gitlab Installation. How is this possible? I cannot find the server gitlab is using at all and how to configure a further website. The OS is Ubuntu 17.04.

edit: I want to run a php project. Usually I am using Apache, where I have sufficient knowledge of.

Upvotes: 3

Views: 1252

Answers (2)

Danny
Danny

Reputation: 1703

as per

Gitlab:Ningx =>Inserting custom settings into the NGINX config

edit the /etc/gitlab/gitlab.rb of your gitlab:

nano /etc/gitlab/gitlab.rb

and sroll to nginx['custom_nginx_config'] and modify as below make sure to uncomment

# Example: include a directory to scan for additional config files
nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/*.conf;"

create the new config dir:

mkdir -p /etc/nginx/conf.d/
nano /etc/nginx/conf.d/new_app.conf

and add content to your new config

# my new app config : /etc/nginx/conf.d/new_app.conf
# set location of new app 
upstream new_app {
  server localhost:1234; # wherever it might be
}
# set the new app server
server {
  listen *:80;
  server_name new_app.mycompany.com;
  server_tokens off;
  access_log  /var/log/new_app_access.log;
  error_log   /var/log/new_app_error.log;
  proxy_set_header Host      $host;
  proxy_set_header X-Real-IP $remote_addr;
  location / { proxy_pass  http://new_app; }
}

and reconfigure gitlab to get the new settings inserted

gitlab-ctl reconfigure

and restart nginx

gitlab-ctl restart nginx

Your new app should be reachable.

ps: to check the nginx error log:

tail -f /var/log/gitlab/nginx/error.log

Upvotes: 3

fhossfel
fhossfel

Reputation: 2181

The recommended way to do is is to disable the internal webserver and use the Apache provided by Ubuntu. There is some documentation on this

Basically you have to change the following:

1.) /etc/gitlab/gitlab.rb:

nginx['enable'] = false

2.) Add www-data to the group gitlab-www

3.) Create a virtual host which looks somewhat like this:

DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

<Location />
   Require all granted
   #Allow forwarding to gitlab-workhorse
   ProxyPassReverse http://127.0.0.1:8181
   ProxyPassReverse http://gitlab.thoughtgang.de/
</Location>

You will find a detailed guide in Gitlab documentation: https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server

I have been doing that with our Gitlab for ages and it runs without any problems.

Upvotes: 1

Related Questions