Cloudflare를 이용해 GitHub Pages를 서브도메인(web.도메인.com)으로 설정 - aquaxysgit/aquaxys.site GitHub Wiki
이름 입력
public 필수 (나중에 수정 가능)
Add a README file
Create Repository
"abc/" 입력하면 폴더 생성 가능
text 파일의 경우 "123.txt(html, json..)" 입력 후 텍스트 내용 입력
[Commit changes]
파일을 선택하여 drag & drop 하면 파일리스트가 아래 생김
[Commit changes]
.github/workflows/gh-pages.yml
index.html
privacy.html (Pages를 구성한 이유인 '개인정보처리방침' 페이지)
name: Deploy to GitHub Pages
on:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./ # index.html이 위치한 경로
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>aquaxys.site</title>
</head>
<body>
<h1>aquaxys.site page</h1>
</body>
</html>
[Settings] - [Pages] - [Deploy from a branch] - [main▼ | /(root)▼] - [Save]
- [Custom domain] - [web.도메인.com] - [Save]
[Settings] - [GitHub Pages] - [Your site is live at http://xxx.github.io/xxx] - [Visit site]
[DNS] - [레코드] - [레코드 추가] - [유형 : CNAME] - [이름 : web] - [대상 : 깃허브 페이지 주소 : xxx.github.io 까지만 입력]
∴ web (원하는 서브도메인 이름 api, sub..)
추가된 모습
github pages에서 custom domain 부분 √ DNS check successful
서브 도메인 Pages 접속 결과