Trying to install GitLab on Apache on CentOS 7 - linux

I'm trying to install GitLab, but I want to install it on an Apache web server on my VPS.
I know that GitLab was built for nginx, but I honestly don't want to use it. I was wondering how I would be able to have a setup so that
mysite.com would retrieve the files (like index.html, folders with more files in them, etc.) in /var/www/html
lab.mysite.com would retrieve GitLab.
I've heard you're supposed to use a virtual host, but remember, I'm still an amateur at best with this kind of stuff, so if anyone here is kind enough to make a short step-by-step guide to do this, I'd appreciate this.
Note: Before I've been using this guide to install GitLab, however this is for Nginx, so I was wondering if I was to use this guide but then add onto it, or if I'm going about this all wrong.

By default GitLab will install nginx but usually won't add nginx to your system's service manager (service or systemctl). This makes it confusing when trying to enable Apache (Apache won't start due to default port 80 in use by nginx).
Assuming you've installed Gitlab according to the default install instructions, the Nginx service will now be managed by the gitlab-ctl service manager (which is installed when installed Gitlab).
To stop Nginx, run the following from a command line as root:
gitlab-ctl stop nginx
Now that port 80 is free, you can start Apache (don't forget to install Apache if it's not already / Instructions are for RHEL systems - modify accordingly for Ubuntu etc). Assumes you are root user:
yum install -y httpd;
systemctl start httpd;
systemctl enable httpd;
Let's edit the Gitlab config file to disable nginx and tell gitlab to use apache:
vi /etc/gitlab/gitlab.rb
Add either your domain or IP to the following:
external_url 'http://git.yourdomain.com/'
Find:
# web_server['external_users'] = []
Change to (don't forget to remove the leading '#'):
web_server['external_users'] = ['apache']
Find:
# nginx['enable'] = true
Change to:
nginx['enable'] = false
And finally we have to run a "recompile" with:
gitlab-ctl reconfigure
gitlab-ctl restart
Now the Apache config. When we installed Gitlab, it added a user group called gitlab-www. We need to allow the apache user access to that group. The following assumes you've installed apache and the user apache (48) exists:
To check which group gitlab installed itself under, you can run:
getent group
Now lets modify apache's user and add it to the gitlab-www group:
usermod apache --append --groups gitlab-www
Now we need an Apache Virtual Host to point to the gitlab install.
Add a virtual host to Apache's conf.d directory (this will create a new file):
vi /etc/httpd/conf.d/gitlab.conf
Add the following (tweak according to your needs):
<VirtualHost *:80>
ServerName git.yourdomain.com
ServerSignature Off
ProxyPreserveHost On
<Location />
Order deny,allow
Allow from all
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://git.yourdomain.com/
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
# needed for downloading attachments
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined env=!dontlog
</VirtualHost>
... And now restart Apache:
systemctl start httpd
You may run into issues with things like selinux - You can set things to permissive for debugging purposes.
setenforce 0
I hope this helps someone!

Related

Error 503 with httpd localhost server on Fedora 35

So I switched to Fedora and wanted to install LAMP on it. So I followed this article: https://computingforgeeks.com/how-to-install-lamp-stack-on-fedora/. Everything has been installed successfully. Afterward, I wanted to change the default root directory. In order to achieve it, I edited /etc/httpd/conf/httpd.conf and have set:
DocumentRoot "/home/muq/Localhost"
User muq
Group muq
<Directory "/home/muq/Localhost">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
And now I am getting the error: 503 Service Unavailable.
If I change User and Group to default (apache) the error I get is: 403 Forbidden.
Previously I was doing the same thing with Apache on PopOS and it was working fine.
Thank you all in advance!
Did you follow the step in the article which says to set SELinux to permissive? My guess is that you didn't, and that's what's happening: SELinux is preventing user home directory files from being served out by the web server.
You could just follow the advice in the article and just turn it off. But, I strongly recommend that you don't. The thing it's protecting you from here is a reasonable one — a misconfiguration could otherwise very easily expose personal user files to the internet. And here's the key thing: fixing this is really easy! At least as easy as the instructions for disabling SELinux in the article! You just need to do:
sudo chcon -R -t httpd_sys_content_t /home/muq/Localhost
to label that directory as one from which you want to serve httpd content. And that should do it — and still give you all the other protection of SELinux.
(You could also consider a location like /srv/www or /var/www/html as your web root, keeping your home directory out of the whole thing. These are parts of the filesystem designated for that, and to me as a former sysadmin seems cleaner. But the choice is yours.)

Ubuntu Desktop 20.04 - Apache2 without VirtualHost Configuration presents Website

please help me with the following problem:
I have a fresh installed Ubuntu Desktop 20.4 here and installed Apache2 from the ubuntu-repository.
For a test I disabled the 000-default.conf from the sites-enabled directory with a2dissite and removed the file 000-default.conf from the sites-available directory. "apachectl configtest" shows that the syntax is ok. "apachectl -S" shows, that there is no virtual host configuration. I have restarted the computer, but the Apache webserver still serves the standard Website. There are fresh entries in the "other_vhost_access.log". I wonder what configuration serves this website. I thought, when there is no conf-file enabled in "sites-enabled" apache doesn't serve any website?!
Where did I go wrong? Didn't find anything while searching. It's difficult to find the keywords.
Thanx for any help in advance.
Regards
Endi
Apache is serving as per config settings in the main configuration files apache2.conf or httpd.conf

installations of cake php website in linux server

I've developed a website in cakephp and it is running successfully in localhost of my windows operating system.Now i need to make it run on Linus static IP server.I also need to know that what are all the softwares needed to install and implementation procedures to upload it and where to upload it.Any help would be greatly appreciate.
You have to research a bit more on the net, there's plenty of answers guiding you how to do it. Stackoverflow is more pertaining to specific coding questions. I personally prefer using amazon ec2 for uploading my cakephp applications.
There's lots of tutorials on how to set up a free tier linux server instance on ec2 all over the net. Here's a great one:
http://www.comtechies.com/2013/01/how-to-host-dynamic-php-website-on.html
Once you have your instance set up, this is what you have to do:
In apache your public folder will be /var/www/ so anything you put in there will be directly accessible to people by URL. Use putty to connect to your server.
sudo service apache2 stop
This will stop your apache server for security reasons while you upload etc.
Copy your project to /var/www/cakephp such that your webroot lies in /var/www/cakephp/app/webroot.
type the following to describe location of cakePHP
nano /var/www/cakePHP/app/webroot/index.php
Go to the line starting with define('CAKE_CORE_INCLUDE_PATH' and make it define('CAKE_CORE_INCLUDE_PATH', DS . 'var' . DS . 'www' . DS . cakephp . DS . lib') - assuming cakephp/lib is to be found in /var/www/cakephp/lib
Next, set the new document root:
sudo nano /etc/apache2/sites-available/default
and wherever you see /var/www change it to /var/www/cakephp/app/webroot.
Also, in the change allowoverride none to allowoverride all the first two times they occur from the top of the document.
To allow apache to access your files and write to cache, execute the following commands:
sudo chown www-data:www-data /var/www/myproject -R
sudo chmod 777 /var/www/myproject/tmp -R
To allow CSS to be applied properly:
sudo a2enmod rewrite
Restart apache:
sudo service apache2 start
Now everything should be working according to plan. If you have any further questions do hit me back!

Configure Apache2 and tomcat7 with mod_jk

I want to configure Apache2 and tomcat7 with mod_jk in Linux environment ..I want to know the steps ..Please help me to congure it...
Have you tried anything yourself?
http://tomcat.apache.org/connectors-doc/generic_howto/quick.html should get you going. But if you have not tried anything yet how can we help you then? Let use know if anything specific goes wrong, including error messages etc.
You have to configuration for the apache (i use CentOS). The first file is under /etc/httpd/conf/wokers.properties
# the name tomcat1 is variable
worker.list=tomcat1
# default ajp port on server.xml of tomcat
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tocmat1.socket_timeout=200
worker.tomcat1.retries=1
The second file depends on whether global or want Customizing for a virtual host. The following example is based on a virtual host (/etc/httpd/conf/virtualhost.conf)
JkWorkersFile "/etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/jk.log
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkLogLevel info
# mount all under URI /
JkMount /* tomcat1
# umount /robots.txt, request goes to apache document root
JkMount /robots.txt tomcat1

How configure SVN in Cpanel/WHM?

I want to install SVN server in my Linax VPS with cpanel/WHM running. When checking RPM packages through WHM and SSH I saw that SVN is Installed as RPM package. How can I make it work ? I'm not that experienced with server administration. Can anyone help ?
I struggled with this for some time, and then eventually contacted CPanel directly. This is what I did to get it to work after some guidance from them. PS. Please ensure that SVN is already installed by calling yum install subversion
) Log in to WHM ( I have root access )
) Go to Home -> Service Configuration -> Apache Configuration
) Click on Include Editor
) Jump To : Pre Main Include 5) Under "I wish to edit the Pre Main configuration include file for:", select All Versions
) Depending on your server's individual settings and paths on your server,
add the below (I use CentOS gcc version 4.4.6 20120305 (Red Hat
4.4.6-4) (GCC))
LoadModule dav_module /usr/lib64/httpd/modules/mod_dav.so
LoadModule dav_svn_module /usr/lib64/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib64/httpd/modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNPath /data/svn/repos
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /data/svn/svn-auth-conf
Require valid-user
</Location>
) Click on Update
) Restart Apache
If Apache restarts, you should be OK. You should then be able to (based on above configuration) to access your SVN through yourdomain.com/svn. Use the htpasswd command to create your svn-auth-conf file
One thing I am struggling with is the following error
[Could not open the requested SVN filesystem] but I have a strong feeling that it has to do with folder permissions relating to apache (httpd) under /data/svn/repos. I am investigating :)
These links also helped me
http://wiki.centos.org/HowTos/Subversion
http://docs.cpanel.net/twiki/bin/view/EasyApache/EasyApacheCustomDirectivesOutsideVirtualHost

Resources