zephyr22's picture

I'm running a TKL LAMP with a TLD on ESXi (10.0.0.10) and this is what I try to do:

10.0.0.30 port 8081 -->sickrage,example,com

10.0.0.30 port 40000 -->utorrent,example,com

(Mollom won't let me use . )

And many more of these.

I have tried every solution i have found, but it just won't work.

DNS is correctly setup with GoDaddy and I can ping the created subdomains. They now show contents from TLD.

How can I make this work?

Please do a "for dummys" version and start with a clean install.

Forum: 
Jeremy Davis's picture

How are you trying to configure it? Personally I much prefer commandline. I find the Webmin config a little confusing.

As for specific config, what exactly are you trying to do? I can think of a number of ways to achevie something like what you are after. You could set Apache to redirect or rewrite the url, something like this:

http://sickrage.example.com -> http://sickrage.example.com:8081 (and serving 10.0.0.30:8081)

Apache docs are here: http://httpd.apache.org/docs/2.4/mod/mod_alias.html I've never used it like this but a rewrite should probably work too? https://httpd.apache.org/docs/2.4/rewrite/remapping.html

Or you could set it up as a reverse proxy, so

http://sickrage.example.com will actually display what you would see at http://10.0.0.30:8081

https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Sorry it's not even close to a "for dummys" explanation. Unfortunately I know Apache much better in theory than I do in practice.

Keep in mind that Debian (the basis of TurnKey; also the basis of Ubuntu) arranges the config files differently to upstream Apache (and other OS like Red Hat - they use a single monolithic config file; in Debian it's split up).

For starters I'd create/adjust the site config within /etc/apache2/sites-available. The file must have a .conf extension. E.g. you might want to put each in their own site file /etc/apache2/sites-available/sickrage.conf etc.

Then disable the default site, enable your new one and restart apache so it uses the new config:

a2dismod 000-default
a2enmod sickrage
service apache2 restart

Then once you've configured it, you need to enable it.

Once you have decided how you want to do it. You should find plenty of info via Google. Just keep in mind my comments above (debian/ubuntu examples should be good). Also note that TurnKey v14.x (Debian Jessie) uses Apache v2.4. So older info (for Apache 2.2) may not work properly (or at all).

zephyr22's picture

I have as you recommended only tried the sites-available solution.

What I have done is;

- Installed TKL Lamp

- Copied 000-default.conf as sickrage.conf

- Edited sickrage.conf with something i found on a forum somewhere:

<VirtualHost *:80>    
        ServerName sickrage.example.com    
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>    
        <Location />
                ProxyPass http://10.0.0.30:8081/
                ProxyPassReverse http://10.0.0.30:8081/
        </Location>    
</VirtualHost>

- Tried to add site with a2enmod sickrage, but get an error saying module does not exist. a2ensite works and adds the site correctly in sites-enabled.

- The MANY variations of the sickrage.conf I have tried did NOT work at all.

I don't know what to try next, but I will be looking into redirecting and rewriting as that may be the way to go.

However, I would really like the sickrage.conf to work as it would be really easy to add more sites as I go.

Thanks for any help I can get with this problem.

Jeremy Davis's picture

That all looks fine. My guess is that you haven't installed Apache's mod_proxy!?

This should do the trick:

apt-get update
apt-get install libapache2-mod-proxy-html
a2enmod proxy_http
service apache2 restart
zephyr22's picture

That is correct!!

Now everyhing works perfectly. Thank you very much :)

Well, almost everything works. Still got to figure out how to vhost a https webui to http subdomain.

But I am very happy with the subdomains I got working. Thanks a lot again.

Jeremy Davis's picture

As for your next issue, what exactly are you trying to do?

Do you want the webUI to use https, then forward to an non-https address? Or are you fine with the WebUI also using plain http too?

zephyr22's picture

I have a few services running that only uses https for webui (esxi host client, a cisco switch etc). I want to redirect these to a non-https subdomain.

I have figured out that I will need to install mod_ssl, but I am very lost on the correct commands for my vhost.conf file.

I know that it is far from a best practice to do this, but I want easy access to all my services and everything will be password protected anyway.

Jeremy Davis's picture

If you are logging in with a plain http connection then the username and password are transferred in plain text. It is relatively trivial for someone on the network to listen in a steal the credentials...

If it's only available within a trusted LAN then that's not such a big deal. But if the connection is over the internet (or worse still via a public wifi), then anyone could theoretically steal your credentials as you log in.

Is there a good reason why you can't use https? Perhaps your energy might be better spent trying to resolve the problem you have with https, rather than trying to work around it?

Re mod_ssl, it's already installed and enabled on all TurnKey LAMP based servers. FWIW the default (custom TurnKey) SSL config can be found in /etc/apache2/mods-available/ssl.conf there is also some additional default (TurnKey) Apache security config in /etc/apache2/conf-available/security.conf

Add new comment