argin
argin

Reputation: 52

Configure Apache to serve different play applications on single domain

I have three applications implemented with Play! framework. I would like to run these apps on a single domain but different urls.

For example:

I am using an AWS Bitnami LAMP stack and I am trying to configure Apache virtual hosts to run the applications on different ports(9000, 9001, 9002). Running a single app works fine but not all three at the same time.

Here's what I have so far for just one app:

<VirtualHost *:80>
  ServerAdmin www.example.com
  ServerName www.example.com
  ServerAlias "/opt/bitnami/apps/first/data"
  DocumentRoot "/opt/bitnami/apps/first/data"

  Include "/opt/bitnami/apps/first/conf/httpd-app.conf"

  ProxyPreserveHost On
  ProxyPass / http://127.0.0.1:9000/ KeepAlive=On timeout=600
  ProxyPassReverse / http:127.0.0.1:9000/
</VirtualHost>

Is the Apache virtual hosts the way to go or is there a better solution?

Upvotes: 0

Views: 49

Answers (1)

Santhoshle
Santhoshle

Reputation: 643

Yes, you can use Apache to serve on single domain using Proxy hosts.

But you need to define in correct hierarchy.

For given Example: You need to define Second app and Third app before defining First app. Else www.example.com/second will detect as www.example.com and redirect to First app.

Upvotes: 1

Related Questions