Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two web applications that run on the same server. Each require a different port number, but only one port is open to the public. My company would rather avoid opening another port up but still wants both to be apps public, so I'm trying to figure out how to have both run. I know a little about apache, but I'm confused on how to set it up to do this. Should I use a reverse proxy or is there another way to accomplish my goal?

share|improve this question
You said: "Each require a different port number". So do you care if an URL looks like ? – Lekensteyn Dec 15 '10 at 15:13
Can you have two different DNS names to point to your public IP? If so, you can host them on the same apache server without the need to change the port. Each app will reside in a different vhost / different path. – Khaled Dec 15 '10 at 15:18
@Lekensteyn they can look like and it will be fine. – evilrobotz Dec 15 '10 at 15:22
@Khaled That may be a possibility. We only have one domain, but do you think that a subdomain (ie: will work? If not then we might purchase a second domain. – evilrobotz Dec 15 '10 at 15:25

You can use apache virtual hosts. Look at this page. You can use another subdomain for the other app. No need to purchase a new domain. Also, you don't need to change the port number. For example, you can use:

# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/app1

# Other directives here


<VirtualHost *:80>
DocumentRoot /var/www/app2

# Other directives here


In this example, the app1 will reside in /var/www/app1 and app2 will reside in /var/www/app2

share|improve this answer
Thanks I'll give this a shot. – evilrobotz Dec 15 '10 at 15:39

Your Answer


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.