By using AWS re:Post, you agree to the Terms of Use

AWS lightsail (wordpress) + static page (CloudFront) on the same domain

0

Hey guys,

I would like to have my blog (Wordpress) on the same domain as the landing page, so something like:

https://website.com/ => Landing Page (CloudFront + S3)
https://website.com/blog => Blog (wordpress)

Is there any way to bound them together somehow using AWS infrastructure? Thanks!

asked 2 years ago35 views
3 Answers
0

naassert,

Thanks for using Lightsail!

I think that this document will point you in the right direction: https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-distribution-serve-content/

A CloudFront distribution can have multiple origins and use "behaviors" to route requests to the correct data based on the request's URI.

I hope this helps!

Donley

Edited by: donleyataws on Feb 5, 2021 11:45 AM

answered 2 years ago
0

Thank you!
Ok, so it's not that easy like I thought :/

I already have a CDN for a static website https://example.com which points to the s3 bucket.
Now I would like to use it and redirect https://example.com/blog to the lightsail instance.

I already created a CDN on the lightsail side and configured everything with a different domain, so I wonder if I need to transfer an instance to EC2 to make it work?

answered 2 years ago
0

Oh, since you mentioned CloudFront I thought you were using the AWS Service and not the Lightsail Distribution service.

The Lightsail Distribution service is tailored to serving traffic from a single lightail instance or a group through a lightsail load balancer. This resource type does provide for path based cache settings, but does not provide for path based origins.

Here are two potential solutions:

  1. Change your instance to serve up the static content at the root as well as the content under "/blog". You can then configure the lightsail distribution to cache those static assets and not cache the blog assets. You will end up with a very similar user experience since the CDN will server all content to the root of your domain through the closest POP.
  2. Switch over to using CloudFront directly so that you will have access to those more advanced features. You do not need to switch to EC2, though, since Lightail instances and Load Balancers can be the origin for CloudFront distributions.

Donley

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions