Apache does something called VirtualHost's. You will, of course, need DNS to go with it.
Edit: Blah stupid mouse.
It also supports a mod_proxy which can do reverse hosts.
Hi, I'm trying to set up a web server, so that when some one looks up w w w.something.com/one/index.html it will go to one web server and if they look up w w w.something/two/index.html it will go to another web server.
Would some type of dns do this, or a proxy server, iptables config ?
Thanks
Apache does something called VirtualHost's. You will, of course, need DNS to go with it.
Edit: Blah stupid mouse.
It also supports a mod_proxy which can do reverse hosts.
Still not underestimating the power...
There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.
Thanks,
the mod_proxy seem the way to go, but I made a mistake with my first post. I would like to beable to do this "something.com/one/index.html" is ip 192.168.1.2
and "something.com/one/second/index.html" to go to 192.168.1.3,
The first address is were everone goes first, and then if they request the second URL they get the page from the second server, were they can do other stuff.
I thought about maybe some code to rediect in html, but i can't do that(code maybe can, but can't in this situation).
I'll try to find someother info to ask more arcute question
A reverse proxy that runs on www.something.com could do redirection based on the path in the URL.
Correct me if I'm wrong Gitsnik, but I don't think that virtual hosts will allow redirection based on URL, that is more for running two differently named websites (e.g. www.something.com and www.somethingelse.com) from the same physical host.
I don't think you could do this with DNS, because it only works with the hostname bit of the URL (e.g. http://<thisbit>/folder/page.htm). I also don't think you could do it with IP tables because in its default configuration it performs redirection based on IP address and/or port in a packet, and not based on data inside the TCP packet (thats where the URL would be in a client request).
Unless theres some sort of extension available for iptables that allows IP address rewriting or session redirection based on information inside the data portion of a TCP packet. It would be complicated to write though, as it would need to cache the packets in the connection that come before the URL is sent. You wouldn't normally see the URL in a HTTP TCP connection until the fourth packet, after the three way handshake is done...
Capitalisation is important. It's the difference between "Helping your brother Jack off a horse" and "Helping your brother jack off a horse".
The Forum Rules, Forum FAQ and the BackTrack Wiki... learn them, love them, live them.
No you are correct, they won't, I was reading between the lines with what compaq was asking - considering the obvious lack of related knowledge, a reverse proxy seems counter-intuitive to what I think he may be trying to achieve.
Personally I would use pound or something similar to reverse proxy, they're tighter and less vulnerable to remotely exploitable flaws (misconfigurations aside!).
Edit: And reading the posts added to the thread since I got here, it seems I didn't get my between the lines stuff correct, and mod_proxy is perfectly acceptable for what he wants. Pound could also do it with its regular expressions.
Still not underestimating the power...
There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.
Should have posted it correct to start withA reverse proxy that runs on Something. could do redirection based on the path in the URL.
Correct me if I'm wrong Gitsnik, but I don't think that virtual hosts will allow redirection based on URL, that is more for running two differently named websites (e.g. Something. and www.somethingelse.com) from the same physical host.
I don't think you could do this with DNS, because it only works with the hostname bit of the URL (e.g. http://<thisbit>/folder/page.htm). I also don't think you could do it with IP tables because in its default configuration it performs redirection based on IP address and/or port in a packet, and not based on data inside the TCP packet (thats where the URL would be in a client request).
Find this page with the info
I should beable to use
The configuration directives discussed in the above sections tell Apache to get content from a specific place in the filesystem and return it to the client. Sometimes, it is desirable instead to inform the client that the requested content is located at a different URL, and instruct the client to make a new request with the new URL. This is called redirection and is implemented by the Redirect directive. For example, if the contents of the directory /foo/ under the DocumentRoot are moved to the new directory /bar/, you can instruct clients to request the content at the new location as follows:
Redirect permanent /foo/ http://www.example.com/bar/
This will redirect any URL-Path starting in /foo/ to the same URL path on the Example Web Page server with /bar/ substituted for /foo/. You can redirect clients to any server, not only the origin server.
Apache also provides a RedirectMatch directive for more complicated rewriting problems. For example, to redirect requests for the site home page to a different site, but leave all other requests alone, use the following configuration:
RedirectMatch permanent ^/$ http://www.example.com/startpage.html
Alternatively, to temporarily redirect all pages on one site to a particular page on another site, use the following:
RedirectMatch temp .* http://othersite.example.com/startpage.html
Redirect permanent something.com/one/files/storage http://www.example.com/storage/
and everthing else get files files from my server.
Capitalisation is important. It's the difference between "Helping your brother Jack off a horse" and "Helping your brother jack off a horse".
The Forum Rules, Forum FAQ and the BackTrack Wiki... learn them, love them, live them.