Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 0) buy domain (namecheap.com)
- # 1) AWS S3
- In AWS create bucket with same name as domain (! with "www." as prefix !). Save. Then edit it
- - Permissions: uncheck all except "ACLs" related.
- - Bucket policy:
- {
- "Version": "2012-10-17",
- "Statement": [
- {
- "Sid": "PublicRead",
- "Effect": "Allow",
- "Principal": "*",
- "Action": "s3:GetObject",
- "Resource": "arn:aws:s3:::BUCKETNAMEHERE/*"
- }
- ]
- }
- - Properties: Static website hosting: Enabled
- - Copy "Bucket website endpoint" url
- # 2) namecheap.com
- - edit domain
- - Advanced DNS:
- | Type | Host | Value | TTL |
- | CNAME Record | www | FULL-BUCKET-WEBSITE-ENDPOINT-URL-HERE | 30 min |
- | URL Redirect Record | @ | http://www.YOURDOMAINHERE/ | Unmasked | |
- # 3) hugo
- - installation
- - goto https://github.com/gohugoio/hugo/releases > download Linux-64bit.deb > install
- - hugo new site APPNAMEHERE
- - cd APPNAMEHERE > git init
- - find hugo template you like and follow install instructions as submodule
- - hugo server
- - edit until you are happy. make sure urls end with "*.html" because it cloudfront will not be able to auto find it without lambda and thats costly
- - hugo -D
- # 4) upload to bucket
- - aws --profile private s3 cp /var/www/USER/APPNAMEHERE/public/ s3://BUCKETNAMEHERE/ --recursive
- # 5) HTTPS
- AWS Certificate Manager
- - Switch to zone "US East (N. Virginia)us-east-1"
- - if new -> Provision certificates
- - follow procedure. Choose DNS check (dont use email check)
- - you will be given CNAME record to add
- - go to namecheap domain -> Advanced DNS
- - "ADD NEW RECORD" -> CNAME Record -> first value from given (but drop the domain name. keep www at the end) -> value paste as is full -> TTL 5min (after certificate will be issued can change to longer)
- - on aws side continue. should be Status -> issued
- CloudFront
- - Create Distribution -> Get Started
- - Origin Domain Name - choose your bucket
- - Alternate Domain Names: enter your "www.domain.com"
- - Default Root Object: index.html
- - SSL Certificate:
- - Select Custom SSL Certificate -> select your certificate from dropdown. (if option is greyed out then certificate is not in correct zone. needs to be us-east-1)
- - Set up other options based on your taste.
- - Save it.
- - Get xxxxxxx.cloudfront.net url and paste it in namecheap "CNAME Record" Host=www value. So now it is not pointing to bucket but to cloudfront.
- - copy Origin address from S3 Static website. Auto pick is not correct one. There /index.html will not be found. Example correct one: `www.accshiftassist.com.s3-website.eu-central-1.amazonaws.com`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement