Reputation: 153
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 of the 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, ELB and Cloudfront.
Thanks!
Upvotes: 1
Views: 769
Reputation: 918
As I understand, main goals is:
"Forwarding root to a subdirectory is not the main part of the question. I want to forward a subdirectory to S3 and everything else to AWS ELB."
This could be done in different way, you can create 2 DNS records like:
www.test.com could be static part of the site (hosted on S3)
api.test.com could point to LBs (1+). Behind LB you can have AutoScaling group for your application
Upvotes: 1
Reputation: 12269
You could use a separate domain for the page hosted on S3. You could drop the www
or replace it with www-2
and make that domain name point to your S3 hosted site while www.mysite.com
continues to point to your ELB.
Upvotes: 0
Reputation: 1499
Hello there. I am not aware of any ways of redirecting root to subdirectory using only DNS. Would be nice to know if there is.
I also dont think it is really overwhelming for nginx to do a permanent redirect using rewrite. Is there a special reason why you dont want the requests to www.mysite.com to hit nginx and go straight to www.mysite.com/site?
http://wiki.nginx.org/HttpRewriteModule
location = / {
rewrite "^$" /site;
}
Hope it helps.
Upvotes: 0