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!

maciej
질문됨 3년 전452회 조회
3개 답변
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

profile pictureAWS
답변함 3년 전
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?

maciej
답변함 3년 전
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

profile pictureAWS
답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠