Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

what I want is,

http://example.com:10522 is working perfect

I want apache to handle it like

http:\\test.example.com

10522 is another webserver not the apache web directory - its standalone web server running on port 10522

share|improve this question
1  
Have you looked at using Apache as a reverse proxy askapache.com/htaccess/reverse-proxy-apache.html or apachetutor.org/admin/reverseproxies ? –  Sim Jun 23 '10 at 7:13

2 Answers 2

up vote 0 down vote accepted

You can do it on a firewall - redirect port 10522 to 80. In iptables, it could be:

iptables -t filter -A INPUT -p tcp --dport 10522 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 10522 -j REDIRECT --to-port 80

Access on test.example.com and test.example.com:10522 will be treated in the same VirtualHost and both will be seen as port 80.

But it's not clear from your question if it is what you want to accomplish. Not even what operating system you use. And what do you mean with "10522 is another webserver"?

EDIT AFTER CLARIFICATION OF ANSWER:

There can be at least two ways how to do it in Apache

  • Mod_proxy and setting up reverse proxy for example.com:10522 as mentioned in another comments. With this, user will see test.example.com all the time
  • Permanent redirection to example.com like this:

    RedirectPermanent / example.com:10522

    And user will be redirected to example.com:10522 at first access to test.example.com

share|improve this answer
    
no no I've already another application is running on port 80 - but its servername is different (domain) for example - main is example.com:80 and test.example.com--> example.com:10522 –  shahjapan Jun 23 '10 at 7:08
    
Ok, so when user access test.example.com, it should serve example.com:10522, right? And on port 80 is Apache, and on port 10522 is another webserver, doesn't even have to be Apache, right? –  mkudlacek Jun 23 '10 at 7:21
    
yes exactly.... –  shahjapan Jun 23 '10 at 7:37

You simply need to configure mod_proxy on your Apache httpd to act as a reverse proxy for test.example.com:10522. The basic examples in the documentation should be sufficient.

share|improve this answer
    
yes I know, but I'm not able to make it working anyhow, I've enabled the proxy module and tried but couldn't succeed ! –  shahjapan Jun 23 '10 at 8:32
    
What's the error message you encounter? What exactly doesn't work? –  joschi Jun 23 '10 at 10:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.