7

Please, I need to set the Github with Apache on Ubuntu Server 4.14 I want to set up my localhost to the / var / www Apache, done that actually. But when I install Gitlab I lose this setting, when you type localhost it falls on the page of Gitlab and I need it from falling in the / var / www Could anyone help me?

1 Answer 1

10

Assuming that you already have installed gitlab, try this:

sudo sh -c "echo 'external_url \"http://localhost:8080\"' > /etc/gitlab/gitlab.rb"

sudo gitlab-ctl reconfigure

sudo gitlab-ctl restart

So now gitlab should be running and set to be listening on port 8080 and be set for your correct url.

Now Apache needs to proxy traffic for requests from that url to gitlab.

Enable the Apache Proxy module.

sudo a2enmod proxy_http

Now create a file for the virtual host, we will call this one gitlab.conf.

sudo vi /etc/apache2/sites-available/gitlab.conf

This is your config file

<VirtualHost *:80>
        ServerName gitlab.localhost
        #git lab passthrough
        ProxyPass         / http://localhost:8080/
        ProxyPassReverse  / http://localhost:8080/
</VirtualHost>

And in your hosts file add this line:

127.0.0.0       gitlab.localhost

Enable the host and test Apache configuration.

sudo a2ensite gitlab.conf

sudo apachectl configtest

Did that last test throw an error?

You may want to check your Apache configs prior to reloading or restarting Apache.

Otherwise you can run the below command, and visit the url you setup

sudo service apache2 reload

Source: http://jasonrichardsmith.org/blog/gitlab-apache-ubuntu

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you my friend! It worked! Just a question... It works the same way using an ip any in place of localhost? or using localhost instead of one domain? Ex.: lab.universidade.org
You can put your external ip too! If you have domain (lab.universidade.org), redirect this subdomain for your external ip! Ex: 123.456.789.100:8080 == lab.universidade.org:8080
If my answer solved your problem, not forget approve please :)
No doubt! I need to configure to use IP/gitlab, you can set this up as? ServerName IP/gitlab? And the hosts would look like? Thank you very much friend!
You dont need edit hosts. Your VirtualHost stay in same form :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.