Ad

Same Domain - 2 Separate Servers

- 1 answer

I have a website that runs on a framework on a LAMP stack.

Now I want to extend this website by adding a bunch of new pages, but served from a different framework on a separate LAMP stack on another server that is prepared to handle more traffic.

I don't want this traffic to pass by the original website as it will be a burden to be processed by the framework. However, I can afford to have apache forwarding the traffic request to a specific folder forwarded to a separate server with a different IP address.

For example:

mydomain.com/ -> goes to server A,

mydomain.com/folder1/ -> goes to server B

How can I accomplish this with apache?

I can even afford setup a separated server to handle the separation of these request, so each server will only receive the requests it is intended to process.

Another option could be to set a subdomain like ww2.mydomain.com pointed to the IP of a separated server but will this affect my SEO ranking?

What are other options and what would be the best option for this case?

Ad

Answer

You are looking for ProxyPass directive. Example location for mydomain.com virtualhost:

<VirtualHost ...>
    ServerName mydomain.com
    ...
    <Location /folder1/>
        ProxyPass http://serverb/
        SetEnv force-proxy-request-1.0 1
        SetEnv proxy-nokeepalive 1
    </Location>
</Virtualhost>
Ad
source: stackoverflow.com
Ad