Apache
Configure Apache deployment to proxy connections to other ports
[+]Finally if everything above worked out for you then Gitlab should be waiting for you at http://git.yourdomain.com:<PORT> where <PORT> is what we set back in step 14. If you’re happy with this then you’re done. Login with the default username and password (admin@local.host / 5iveL!fe) for Gitlab and start using it. If you’re already running a web server and couldn’t run Gitlab on standard web ports add the following to your Apache config to proxy connections from Apache to Gitlab
[root@localhost~] vim /etc/httpd/conf/httpd.conf # -------- Make the following edits -------- <VirtualHost *:80> ServerName git.yourdomain.com DocumentRoot /data/apps/sa_gitlab/gitlab/public CustomLog logs/git.yourdomain.com combined ErrorLog logs/git.yourdomain.com-error.log ProxyPass / http://127.0.0.1:65527/ ProxyPassReverse / http://127.0.0.1:65527/ ProxyPreserveHost On </VirtualHost> # -------- Save and close the file -------- [root@localhost~] /etc-init.d/apache2 restart
Redirects apache connections to internal (privates IPs) servers
[+]
Based on https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension and https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04
Scenario: We have a main server typically with some hostname: main.server.com and we have an application called, e.g., `app` in and internal server with internal IP: 192.168.1.66 and running our `app` as `http://192.168.1.66/app`
In the main server, run the following command to get a list of available Apache modulesOnce you are prompted with the choice of modules you desire, you can pass the below line listing the module names:
The list of modules:
The main server works as usual except when the URL with the `app` is requested: http://main.server.com/app. The following configuration allows to serve the `app` from the internal server!
It is accomplished if we modify the default configuration file 000-default.conf inside /etc/apache2/sites-enabled to set up "proxying" functionality.
Here, we will be defining a proxy virtual host using mod_virtualhost and mod_proxy together.
Copy-and-paste the below block of configuration, amending it to suit your needs:
Execute the following command to restart Apache:
You can make /var/www/html/app a real folder and put there, for example, redirections from other domains.
and
Scenario: We have a main server typically with some hostname: main.server.com and we have an application called, e.g., `app` in and internal server with internal IP: 192.168.1.66 and running our `app` as `http://192.168.1.66/app`
In the main server, run the following command to get a list of available Apache modules
a2enmod # You will be presented with an output similar to: # Your choices are: access_compat actions .... # Which module(s) do you want to enable (wildcards ok)?
The list of modules:
proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
The main server works as usual except when the URL with the `app` is requested: http://main.server.com/app. The following configuration allows to serve the `app` from the internal server!
It is accomplished if we modify the default configuration file 000-default.conf inside /etc/apache2/sites-enabled to set up "proxying" functionality.
Here, we will be defining a proxy virtual host using mod_virtualhost and mod_proxy together.
Copy-and-paste the below block of configuration, amending it to suit your needs:
<VirtualHost *:*> ServerName main.server.com # ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Servers to proxy the connection, or; # List of application servers: # Usage: # ProxyPass / http://[IP Addr.]:[port]/ # ProxyPassReverse / http://[IP Addr.]:[port]/ # Example: ProxyPass /app http://192.168.1.66/app ProxyPassReverse /app http://192.168.1.66/app </VirtualHost>
Execute the following command to restart Apache:
systemctl restart apache2
You can make /var/www/html/app a real folder and put there, for example, redirections from other domains.
<VirtualHost *:*> ServerName other.com # ServerAdmin webmaster@localhost DocumentRoot /var/www/html ProxyPass /app http://192.168.1.66/app ProxyPassReverse /app http://192.168.1.66/app </VirtualHost>
and
<html><head><title>other</title> <meta http-equiv="refresh" content="0; url=http://other.com/app"> <body></body></html>