sailer403
By:
sailer403

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

August 3, 2017 363 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: https://pastebin.com/fyBLLbEw)
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: https://pastebin.com/6rFTjVnN

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 https://download.nextcloud.com/server/releases/nextcloud-12.0.0.tar.bz2"
3. "curl -LO https://download.nextcloud.com/server/releases/nextcloud-12.0.0.tar.bz2.sha256"
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/nextcloud.sh" - Created a Script for the Install, Here it is: https://pastebin.com/zCEeCNVG
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';"
16. "FLUSH PRIVILEGES;"
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 https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh"
5. "sudo bash /tmp/script.deb.sh"
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: https://pastebin.com/uH1Bqza1

1. "sudo nano /etc/gitlab/gitlab.rb"
 * Line 13 - Changed "external_url" to "http://gitpage.mysite.com"
 * 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'] = [ '192.168.1.0/24', '192.168.2.1', '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: https://pastebin.com/htnLUq7u

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 gitlab.mysite.com, whatever.mysite.com), 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 "gitpage.mysite.com", I get a "Unable to connect" error as shown here.

I HAVE BEEN TRYING TO SOLVE THIS PROBLEM FOR A LONG TIME BUT I KEEP HITTING A BRICK WALL! PLEASE

1 Answer

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

...
<VirtualHost *:80>
  ServerName http://gitpage.mysite.com
  ServerSignature Off
...

Change to

...
<VirtualHost *:80>
  ServerName gitpage.mysite.com
  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.