1

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.

DS87
  • 536
  • 3
  • 9
  • 29
  • GItLab comes with an own nginx. You can simply install another nginx or apache and run your website on that. But you have to specify the ports and proxy. – talaub Jul 03 '17 at 14:51
  • Why not set up another VM? It's really not a good idea as far as performance, or configuration management goes. If you really want to, you need to look into the custom NGINX config to add different routes/vhosts. – Jonathon Reinhart Jul 03 '17 at 14:51
  • Thats my problem. I do not find any nginx config. I also tried to install apache, but i cannot run the service. – DS87 Jul 03 '17 at 14:55
  • 1
    Maybe because they run on the same port (80)? To configure the gitlab nginx to run on a different port you can use the [`gitlab.rb`-file](https://docs.gitlab.com/omnibus/settings/configuration.html) – talaub Jul 03 '17 at 15:04
  • OMG... A tooo long day for me. Indeed it was the port! Haha. Now Apache is working! Thanks a lot!!!! – DS87 Jul 03 '17 at 15:09
  • You might want to take a look at my answer [how-to-serve-other-vhosts-next-to-gitlab-omnibus-server-full-step-by-step-solution](https://stackoverflow.com/questions/31762841/how-to-serve-other-vhosts-next-to-gitlab-omnibus-server-full-step-by-step-solu/39695791#39695791) – Danny Aug 04 '17 at 08:54

2 Answers2

2

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
Danny
  • 1,603
  • 1
  • 15
  • 25
1

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.

fhossfel
  • 2,041
  • 16
  • 24