apache config question

Discuss Networking
Post Reply
User avatar
cdhgold
administrator
administrator
Posts: 382
Joined: Tue Mar 18, 2003 6:11 pm
Location: Texas

apache config question

Post by cdhgold »

I have differnt admin utils i access via the web I want a way to access them via name instead of port .. for example instead of going to https://www.wherever.com:10000 for webmin I want to go to https://webmin.wherever.com .. would i do this thru apache config and if so where can i find documentation on how to configure .. not sure what search term to use for that. and if this is possible to setup is it then possible to configure system to reject the https://www.wherever.com:10000

Chris

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

This is an interesting question because webmin is it's own web server (it doesn't use Apache, but a simple perl server called miniserv.pl). You tell webmin to listen on a specific port (default is 10000 of course) in it's configuration. Now, since you are using SSL (https) and if you don't use SSL for Apache then this would be easy. Just configure webmin to use port 443 instead of 10000 and be done with it. Make sure you have SSL turned off in Apache (or configure it so it listens on a port other than the default 443).

This would be the easiest and if it will work for you I'll leave it at that. If it doesn't then things could be more difficult. A single port can only be used by one process so if you want to bind another program (like webmin) to a port that Apache is already using then it could be difficult. I think it may be possible to have Apache redirect the connection to another port though so you could run your other app on another port and have Apache do the trickery. I assume you only have one IP address to work with or do you have more than one address from your provider that you can work with?

User avatar
cdhgold
administrator
administrator
Posts: 382
Joined: Tue Mar 18, 2003 6:11 pm
Location: Texas

Post by cdhgold »

i don't have anything else that uses port 443 on apache yet. my question is more than just webmin . for example another service uses port 8080 and i would like to hit it thru like http://util.domain.com instead of http://www.domain.com:8080 .. i thought i read or heard at one time that there is away to have apache be able to do this but don't remember where i read it was on a different forum i believe. i don't want to bind multiple services to same port i want to be able to use different fqdn for each port . i only have one IP.

chris

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Ok, I did just figure out a way to do this using the "ProxyPass" statement. Say I want to access webmin running on my server on port 10000 via "http://webmin.mydomain.com/" (via port 80). I would first create a DNS entry "webmin.mydomain.com" that points to my server's IP address. I would then create a virtual host:

Code: Select all

<VirtualHost *>
    ServerName webmin.mydomain.com
    ServerAdmin root@localhost
    ProxyPass / http://webmin.mydomain.com:10000/
</VirtualHost>
If you wanted to block port 10000 then I believe you should be able to do so with iptables, as long as you do not block it for your server's own IP address (It will be talking to itself on port 10000, proxying in/out from port 80).

That's about all there is to it, at least in my tests everything worked like a champ. Have fun!

User avatar
cdhgold
administrator
administrator
Posts: 382
Joined: Tue Mar 18, 2003 6:11 pm
Location: Texas

Post by cdhgold »

thanks void that looks just like what i need. will try it out on webmin and my other utils.

thanks again,
chris

User avatar
cdhgold
administrator
administrator
Posts: 382
Joined: Tue Mar 18, 2003 6:11 pm
Location: Texas

Post by cdhgold »

added the DNS entries and the virtual hosts section to the virtual hosts conf file for the domain. when i restart apche2 I get

Invalid command 'ProxyPass', perhaps mis-spelled or defined by a module not included in the server configuration

how do i add the mod_proxy module tp apache2 so that it recognizes the command?

Chris

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Hmmm, I didn't have to do anything, it was already installed on my Fedora installation. The modules are in /var/lib/httpd/modules (your path will surely be different) and my httpd.conf has these lines:

Code: Select all

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
Not sure if they are all associated with mod_proxy. I don't know if it is a separate package for SUSE or if they just didn't compile it in. Might have to get the Apache SRPM for your distro and modify the spec file to compile in mod_proxy support if the modules aren't there already.

It's funny, I did a search looking for a SUSE specific answer to your question and look what I find:

http://www.swelltech.com/pipermail/webm ... 16933.html

These guys just happen to be talking about the same thing (webmin via mod_proxy).

Post Reply