I am trying to build a reverse proxy to front end some virtual desktops that are running VMware View direct connect. I want users to be able to type https://server/desktop1, or https://server/desktop2, based on the path then it needs to reverse proxy to the right IP address. I have tried numerous rules, with really no luck.
Currently the server is running apache 2.4 and Ubuntu Server 14.
inside your VirtualHost you should write the followings:
ProxyPass /desktop1 http://ip.of.desktop.1/
ProxyPassReverse /desktop1 http://ip.of.desktop.1/
ProxyPass /desktop2 http://ip.of.desktop.2/
ProxyPassReverse /desktop2 http://ip.of.desktop.2/
You have also to make sure that you installed and enabled needed modules
aptitude install -y libapache2-mod-proxy-html
a2enmod proxy
a2enmod proxy_http
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_connect
a2enmod proxy_html
then restart apache2 and check...
Related
I've been playing around with trying to stand up a server that simply proxies requests to it to a different website (https://github.com) in this simple example and I just haven't been able to get it to work.
I have a simple Dockerfile
FROM ubuntu:14.04
RUN apt-get update -y && \
apt-get install -y apache2 libapache2-mod-wsgi curl
RUN a2enmod proxy
RUN a2enmod proxy_http
RUN service apache2 restart
That I'm running with docker run -it -p 80:80 --name apache proxy-test /bin/bash after building it
Once in the container, I created this file under /etc/apache2/sites-available/site1.docker.biz.conf:
<VirtualHost *:80>
ServerName test-apache.biz
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass "/github" "https://github.com"
ProxyPassReverse "/github" "https://github.com"
</VirtualHost>
Then ran:
a2ensite site1.docker.biz.conf
service apache2 reload
I want to be able to go to http://localhost:80/github and see https://github.com but I get a The requested URL /github was not found on this server.. Am I missing something?
I'm currently running a ubuntu webserver with apache2, hosting multiple sites and subdomains. I would like to host bitwarden on my own webserver, which is only shipped in a docker container with nginx.
I would like to use a subdomain e.g. bitwarden.domain.com to access bitwarden. But I have no idea how to configure apache2 / host to pass through traffic going to bitwarden.domain.com to the docker container running bitwarden (without affecting the other domains).
My question: How to configure apache2/docker to achieve this? Is there any documentation/tutorial for this?
After starting the docker container, grab the container ip, port:
local_docker_ip, local_docker_port
And you have a couple of options:
Use apache2 Virtual host with a redirect:
<VirtualHost *:80>
ServerName bitwarden.domain.com
Redirect permanent / http://{local_docker_ip}:{local_docker_port}/
</VirtualHost>
Or use the apache2 proxy module. First, enable proxy modules by running the commands:
a2enmod proxy
a2enmod proxy_http
Then, add the following virtual host:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName bitwarden.domain.com
ProxyPass / http://{local_docker_ip}:{local_docker_port}/
ProxyPassReverse / http://{local_docker_ip}:{local_docker_port}/
</VirtualHost>
I hope it helps
I'm trying to use the Websocket Proxy in Apache, but keeps reporting non existent module.
$ sudo a2enmod mod_proxy_wstunnel
ERROR: Module mod_proxy_wstunnel does not exist!
This should be available from 2.4.5!
https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html
Is this an Ubuntu version problem?
How can I install this?
Try with proxy_wstunnel
$ sudo a2enmod proxy_wstunnel
I'm trying to run an Apache Solr Service (on its emdedded jetty server) on a remote server. The admin has provided me following information:
DNS: my.server.com
IP: xxx.xxx.xxx
Server OS: 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux
Only Port 80 is accessible. On the server we want to deploy Apache Solr and a microservice which uses Solr as search engine. I want to use Apache Webserver to forward the HTTP-Request to the Solr Admin UI and to the microservice UI, but it doesn't seem to work, I use Apache Server version: Apache/2.4.10 (Debian)
Server built: Sep 15 2016 20:44:43.
I installed Apache and started the server, so far everything works as expected. I can access the admin view from Apache entering the DNS in my browser.
I enabled a few modules following this articel https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension:
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html
Then I tried to configure a virtual host under /etc/apache2/sites-available/myconf.conf:
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ProxyPass /solr http://my.server.com:8983 retry=0 timeout=5
ProxyPassReverse /solr http://my.server.com:8983
ProxyPass /microservice http://my.server.com:6868 retry=0 timeout=5
ProxyPassReverse /microservice http://my.server.com:6868
LogLevel debug
</VirtualHost>
Solr uses its standard port 8983 and the microservice will be on port 6868. When I try to acces solr with http://my.server.com/solr I get an HTTP 503 Service unavailable.
I first tried this:
/usr/sbin/setsebool -P httpd_can_network_connect 1
But it changed nothing. I also had to install first:
apt-get install policycoreutils
to make this option available. The solr service seems to be ok:
solr status
Found 1 Solr nodes:
Solr process 14082 running on port 8983
{
"solr_home":"/etc/apache-solr/solr-6.2.0/server/solr",
"version":"6.2.0 764d0f19151dbff6f5fcd9fc4b2682cf934590c5 - mike - 2016-08-20 05:41:37",
"startTime":"2016-10-07T12:02:05.300Z",
"uptime":"0 days, 1 hours, 29 minutes, 55 seconds",
"memory":"29.7 MB (%6.1) of 490.7 MB"}
The Apache log keeps saying:
The timeout specified has expired: AH00957: HTTP: attempt to connect to xxx.xxx.xxx:8983 (my.server.com) failed
AH00959: ap_proxy_connect_backend disabling worker for (my.server.com) for 0s
AH01114: HTTP: failed to make connection to backend: my.server.com
Without my timeout setting everthing keeps the same but it takes ages before I get the 503 Error.
Any hints? After one day struggeling I'm depressed ... all I want is to finish the task.
Thanks in advance!
It turns out that I needed to append a slash to the urls:
ProxyPass /solr/ http://my.server.com:8983/ retry=0 timeout=5
ProxyPassReverse /solr/ http://my.server.com:8983/
ProxyPass /microservice/ http://my.server.com:6868/ retry=0 timeout=5
ProxyPassReverse /microservice/ http://my.server.com:6868/
I've got a problem with my apache configuration.
I'm running a apache2 in a docker container.
In the same container is a webrick running on port 3000
What I want is that when someone calls subdomain.mydomain.de
There should be a pass through to
subdomain.mydomain.de:3000
I've done this:
sudo nano /etc/apache2/sites-enabled/000-default.conf
added this in default.conf
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName mydomain.de
ServerAlias *.mydomain.de
ProxyPass / http://subdomain.mydomain.de:3000/
ProxyPassReverse / http://subdomain.mydomain.de:3000/
</VirtualHost>
a2enmod proxy
sudo /etc/init.d/apache2 restart
But all what I got is this:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at [no address given] to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error
log.
Solution for this problem is:
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo service apache2 reload