STUCK! Cant Install 2 Services On Top of Each Other - Help a Noob Out? [Long Time Problem] [Gitlab]

August 3, 2017 1.2k views
Git Apache DigitalOcean Articles Development Nginx Linux Basics Open Source LAMP Stack Linux Commands Ubuntu 16.04

Hello, so I am having huge troubles setting up Gitlab and NextCloud to work with each other. I have seriously attempted a huge number of times only to fall flat on my face and I have no idea why. Im going to document my steps here.

In this case, I am installing on a personal VM. I want to try this locally before deploying to DigitalOcean.

Firstly, I installed the LAMP stack from this guide here. Here is all the commands I entered in the exact order:

1. "sudo apt-get update"
2. "sudo apt-get install apache2 -y" (Installed Apache)
3. Added "ServerName" to the apache2.conf (apache2.conf looks like this:
4. "sudo apache2ctl configtest" - Got "Syntax OK"
5. "sudo systemctl restart apache2"
6. "sudo ufw allow in "Apache Full"
7. "sudo apt-get install mysql-server -y" (Root password is "root")
8. "sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql"
9. "sudo nano /etc/apache2/mods-enabled/dir.conf"
10. "sudo systemctl status apache2" - Result:

I can successfully see my webserver along with my PHP info page.

Then I installed NextCloud from the page here.

1. "cd /tmp"
2. "curl -LO"
3. "curl -LO"
4. "shasum -a 256 -c nextcloud-12.0.0.tar.bz2.sha256 < nextcloud-12.0.0.tar.bz2" - Came back "OK"
5. "rm nextcloud-12.0.0.tar.bz2.sha256"
6. "sudo tar -C /var/www -xvjf /tmp/nextcloud-12.0.0.tar.bz2"
7. "nano /tmp/" - Created a Script for the Install, Here it is:
8. "sudo nano /etc/apache2/sites-available/nextcloud.conf"
9. "sudo a2ensite nextcloud"
10. "sudo a2enmod rewrite"
11. "sudo apt-get update"
12. "sudo apt-get install  php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip"
13. "sudo systemctl reload apache2"
14. "mysql -u root -p"
15. "GRANT ALL ON nextcloud.* to 'nextcloud'@'localhost' IDENTIFIED BY 'nextcloud';"
17. "exit"

I can see NextCloud installation at http://IP_ADDRESS/nextcloud/
I did not set up Nextcloud at this point, I just visit the page to see if it works

Then I installed Gitlab from this guide here

1. "sudo apt-get update"
2. "sudo apt-get install ca-certificates curl openssh-server postfix"
3. "cd /tmp"
4. "curl -LO"
5. "sudo bash /tmp/"
6. "sudo apt-get install gitlab-ce"
7. "sudo gitlab-ctl reconfigure"
8. "sudo ufw allow http"
9. "sudo ufw allow OpenSSH"
10. "sudo reboot"

Before, when I used to visit http://IP_ADDRESS/, I get the default Apache page as shown here. Now when I visit, I get the Gitlab page as shown here.

Next, I used this guide here by Gitlab to try to set up Gitlab with Apache

Gitlab Config (gitlab.rb) before any edits:

1. "sudo nano /etc/gitlab/gitlab.rb"
 * Line 13 - Changed "external_url" to ""
 * Line 766 - Changed to: web_server['external_users'] = ['www-data']
 * Line 779 - Changed to: nginx['enable'] = false
 * Line 818 - Changed to: nginx['listen_port'] = 8181
 * Line 100 - Changed to: gitlab_rails['trusted_proxies'] = [ '', '', '2001:0db8::/32' ]

2. "sudo gitlab-ctl reconfigure"

At this point, when visiting http://IP_ADDRESS/, I get this error here.

3. Created a file called "gitlab-apache24.conf" in /etc/apache2/sites-available (using "sudo nano /etc/apache2/sites-available/gitlab-apache24.conf")
 * New Server Configuration:

4. "sudo a2ensite gitlab-apache24.conf"
5. "sudo a2enmod proxy"
6. "sudo a2enmod proxy_http"

Now I am completely stuck. If i visit any page other than the actual subdomain (like,, I get the standard "Apache2 Installed" page (and can visit nextcloud by adding "/nextcloud" to the URL). But if I try to visit the actual domain "", I get a "Unable to connect" error as shown here.


1 Answer

Try removing http from the line 13 in pastebin file you linked (New Server Configuration)
You current have

<VirtualHost *:80>
  ServerSignature Off

Change to

<VirtualHost *:80>
  ServerSignature Off

It looks okay, I'm not really sure why it's not working but try this, maybe you'll see correct blocks

Have another answer? Share your knowledge.