You are here
Hi,
in the moment i use a turnkey lamp on my own vsphere enviroment. I have one static IP and connected my domain-name via DNS-A-Record to this IP and the turnkey lamp. Everything works fine.
Now i want to use a second turnkey lamp with a subdomain over the same IP. So i connected the new subdomain via DNS-A-Record to my static IP and the requests arrives on the 1st turnkey lamp. Now i enabled the proxy module on the 1st turnkey lamp and use the following configuration:
/etc/apache2/mods-enabled/proxy.conf:
ProxyRequests Off <Proxy *> AddDefaultCharset off Order deny,allow Allow from all </Proxy> ProxyVia On
/etc/apache2/sites-available/default
NameVirtualHost subdomain.example.com:80 <VirtualHost subdomain.example.com:80> ServerName subdomain.example.com ProxyPass / http://192.168.2.12:80/ ProxyPassReverse / http://192.168.2.12:80/ </VirtualHost> NameVirtualHost subdomain.example.com:443 <VirtualHost subdomain.example.com:443> ServerName subdomain.example.com ProxyPass / https://192.168.2.12:443/ ProxyPassReverse / https://192.168.2.12:443/ </VirtualHost> NameVirtualHost *:80 <VirtualHost *:80> ServerName www.example.com Redirect permanent / https://www.example.com/ </VirtualHost> NameVirtualHost *:443 <VirtualHost *:443> SSLEngine on SSLCertificateFile /var/ssl/www.example.com.crt SSLCertificateKeyFile /var/ssl/www.example.com.key SSLCACertificateFile /var/ssl/intermediate.crt ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/ </VirtualHost> ...
/etc/hosts
127.0.0.1 localhost 127.0.1.1 lamp 192.168.2.8 www.example.com 192.168.2.12 subdomain.example.com
The apache-server starts without any error or warning, but the routing to the new turnkey lamp does not work? All requests to the subdomain are processed by the 1st turnkey lamp.
Can everybody help? What's wrong on my configuration?
Thanks!
SSL Handshake
The main problem is the SSL handshake. The first turnkey must handle the SSL handshake before any request will be processed. So i have changed the configuration:
/etc/apache2/sites-available/default:
Now the SSL handshake works, but now i got an error on the page:
Bad Request
Your browser sent a request that this server could not unterstand.
Solution
The problem was a usage of mod_rewrite definition outside the <virtualhost>. I moved it inside and everything works. Here the final configuration:
/etc/apache2/mods-enabled/proxy.conf (not neccessary to enable for reverse proxy):
/etc/apache2/sites-available/default
Great work
Hi, i now upgrade to turnkey
Hi, i now upgrade to turnkey 14.0 with apache 2.4.10. Now I've got a new error:
Proxy Error
The proxy server could not handle the request GET /.
Reason: Error during SSL Handshake with remote server
What is the difference between the configuration of apache 2.2 to apache 2.4 that causes this error?
Can everybody help?
Thanks!
First thing to do is add .conf
Don't forget to restart Apache when you're done.
If you still have problems check the Apache log (tail /var/log/apache2/error.log) for clues on what might be causing the issue.
SSL certification
Hi Jeremy,
once again! Thanks for your fast response, really!
Yes, i rename it to default.conf. The error.log contains some hints:
The problem is the verification of the SSL certificate. The apache server don't trust my certificate? I order this from my provider (its not self signed), i dont know whats wrong with my SSL certificate?
A quick solution is to disable SSL verification by adding this lines in the SSLProxyEngine section:
But I'am not sure if this a secure solution?
AFAIK proxying SSL requires additional set up
So the "proper" SSL connection needs to terminate at the front end reverse proxy (not the backend server). IMO so long as the backend server is not public internet available, then the easiest is to just use plain HTTP between the proxy and the backend (so long as no one can listen in, no need to encrypt it IMO).
OTOH if your backend is connected via some hostile network (i.e. not direct private communication) or you are concerned about the possibility of someone snooping (e.g. a wifi hotspot running on the same network) then you'll need to set up an additional SSL connection between your proxy and your backend.
There are different ways to skin that cat; but it is well summarised on InfoSec StackExchange here. Personally I'd go with his first suggestion...
Yes, you are right.
Yes, you are right. The internat traffic don't have to be encrypted. And yes, except someone is snooping our internal network.
But with the solution above the transfer is still encrypted, only the verification of the certificate is disabled. So, it should be save.
I'm just looking for a pretty solution and want to understand why the ssl verification in the apache 2.4.xx failed, but not in the apache 2.2.xx. I will just look in more apache specific groups ... i dont found a hint in the release notes.
Thanks g.g.
That's a good point...
FWIW, as I think I posted earlier, under the hood TurnKey is Debian (v13.x = Debian Wheezy; v14.x = Debian Jessie).
Thanks a lot!
Hi Jeremy,
thanks a lot for your help and discussion. I will ask in an other forum and post my final results here.
g.g.
No problem. Sorry I couldn't adequately answer your question
Quick solution
I dont find a solution for the SSL verification of the proxys. I use SSL, but i disable the verification by these lines:
It works. Another way is to use not encrypted traffic between the internal server, but i dont try it.
Add new comment