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.

Essentially, I need to know how to point one URL/folder to a web server and a different URL/folder to an EC2 app server. I'm trying to setup a SAAS with the following URL configuration.

www.mysite.com/ --> forward to www.mysite.com/site www.mysite.com/site --> company public page hosted on S3

All other URLs should point to EC2 servers where my SAAS is running on NGINX and PHP. How can I configure this? Ideally, I'd like the users accessing the company public page to avoid hitting the nginx servers and go directly to the S3 hosting. Is that possible? I'd like to use AWS Route53 and Cloudfront.

Thanks!

share|improve this question

1 Answer 1

Because you're using S3 and Cloudfront, this is possible. You can setup multiple behaviours, each with a path pattern that then fetches content from different origins, as well as use S3 redirects.

So to do this:

  • Setup a redirect, using instructions at http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html so the S3 bucket redirects from the root / -> /site/

  • You then setup different behaviours on Cloudfront:

    Behaviour 1

    Path Pattern: /
    Origin: The S3 bucket
    

    Behaviour 2:

    Path Pattern: /site/*
    Origin: The S3 bucket
    

    Behaviour 3:

    Path Pattern: *
    Origin: The webserver on EC2
    

(Yes... I know this answer is very late!)

share|improve this answer

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.