ReadMe 작성
This commit is contained in:
@@ -111,4 +111,129 @@ HTTPS 환경에 맞춰 `/etc/gitea/app.ini` 파일을 `vi`로 수정했습니다
|
||||
|
||||
2. **IP 리다이렉트:** `34.19.79.94` 입력 시 자동으로 도메인 주소로 전환됨.
|
||||
|
||||
3. **파일 전송:** 포트 22번을 통해 SFTP 방식으로 안전하게 파일 관리 중.
|
||||
3. **파일 전송:** 포트 22번을 통해 SFTP 방식으로 안전하게 파일 관리 중.
|
||||
|
||||
|
||||
|
||||
# 🚀 Gitea & Quartz 도메인 통합 및 서버 설정 가이드
|
||||
|
||||
본 가이드는 단일 메인 도메인(`white-smith.duckdns.org`)에서 **Quartz(블로그)**와 **Gitea(Git 서비스)**를 충돌 없이 운영하기 위한 설정법을 다룹니다.
|
||||
|
||||
---
|
||||
|
||||
## 1. 서비스 주소 설계
|
||||
|
||||
동일 도메인 점유 문제를 해결하기 위해 **하위 경로(Path)** 방식으로 서비스를 분리했습니다.
|
||||
|
||||
- **Quartz (메인 블로그):** `https://white-smith.duckdns.org/`
|
||||
|
||||
- **Gitea (코드 저장소):** `https://white-smith.duckdns.org/git/`
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 2. Gitea 설정 수정 (`app.ini`)
|
||||
|
||||
Gitea가 `/git/` 경로를 인식하도록 내부 설정을 변경해야 합니다.
|
||||
|
||||
- **파일 위치:** `/var/lib/gitea/custom/conf/app.ini` (또는 설치 경로 내 `custom/conf/app.ini`)
|
||||
|
||||
- **수정 내용:**
|
||||
|
||||
Ini, TOML
|
||||
|
||||
```
|
||||
[server]
|
||||
ROOT_URL = https://white-smith.duckdns.org/git/
|
||||
LOCAL_ROOT_URL = http://127.0.0.1:3000/
|
||||
HTTP_ADDR = 127.0.0.1
|
||||
HTTP_PORT = 3000
|
||||
```
|
||||
|
||||
> **Tip:** `LOCAL_ROOT_URL`을 추가해야 내부 리다이렉션 시 404 오류를 방지할 수 있습니다.
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 3. Nginx 역방향 프록시 설정
|
||||
|
||||
`/etc/nginx/sites-available/gitea` 파일을 수정하여 두 서비스를 통합합니다.
|
||||
|
||||
Nginx
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
server_name 34.19.79.94 white-smith.duckdns.org;
|
||||
return 301 https://white-smith.duckdns.org$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name white-smith.duckdns.org;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/white-smith.duckdns.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/white-smith.duckdns.org/privkey.pem;
|
||||
|
||||
# [우선순위 1] Gitea 설정
|
||||
location /git/ {
|
||||
proxy_pass http://127.0.0.1:3000/; # 끝에 '/' 필수
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# [우선순위 2] Quartz 설정 (메인)
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080; # Quartz 실행 포트
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 권한 관리 및 접근 (etc 경로)
|
||||
|
||||
시스템 설정 파일을 편리하게 수정하기 위해 권한을 조정하거나 도구를 활용합니다.
|
||||
|
||||
1. **권한 변경 (추천):**
|
||||
|
||||
Bash
|
||||
|
||||
```
|
||||
sudo chown -R root:$(whoami) /etc/nginx
|
||||
sudo chmod -R 775 /etc/nginx
|
||||
```
|
||||
|
||||
2. **포트 확인 명령어:**
|
||||
|
||||
Bash
|
||||
|
||||
```
|
||||
sudo ss -tulpn | grep node # Quartz 포트 확인
|
||||
```
|
||||
|
||||
3. **서비스 재시작:**
|
||||
|
||||
Bash
|
||||
|
||||
```
|
||||
sudo nginx -t && sudo systemctl restart nginx
|
||||
sudo systemctl restart gitea
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 5. 핵심 주의사항
|
||||
|
||||
- **Nginx 경로 슬래시:** `proxy_pass http://127.0.0.1:3000/;` 처럼 끝에 `/`가 있어야 `/git/` 경로가 중복되지 않고 올바르게 전달됩니다.
|
||||
|
||||
- **Quartz 실행:** Quartz를 `npx quartz build --serve`로 띄운 경우 해당 포트(보통 8080)가 Nginx 설정과 일치해야 합니다.
|
||||
|
||||
- **보안:** `/etc` 전체 권한을 `777`로 바꾸지 마세요. 필요한 폴더만 그룹 권한을 부여하는 것이 안전합니다.
|
||||
Reference in New Issue
Block a user