1

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?

4
  • You said: "Each require a different port number". So do you care if an URL looks like http://example.com:81/ ?
    – Lekensteyn
    Dec 15, 2010 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, 2010 at 15:18
  • @Lekensteyn they can look like example.com:81 and it will be fine. Dec 15, 2010 at 15:22
  • @Khaled That may be a possibility. We only have one domain, but do you think that a subdomain (ie: pub.example.com) will work? If not then we might purchase a second domain. Dec 15, 2010 at 15:25

1 Answer 1

0

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
ServerName app1.example.com

# Other directives here

</VirtualHost>

<VirtualHost *:80>
DocumentRoot /var/www/app2
ServerName app2.example.com

# Other directives here

</VirtualHost> 

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .