readme.md 수정
This commit is contained in:
88
README.md
88
README.md
@ -5,7 +5,7 @@
|
||||
Cafe24 10G 자이언트플러스 환경과 최대한 동일한 테스트 서버 구성을 위한 완전 자동화 스크립트 모음입니다.
|
||||
|
||||
### 구성도
|
||||
`
|
||||
```
|
||||
|
||||
Proxmox VE (호스트)
|
||||
|
||||
@ -20,13 +20,13 @@ Cafe24 10G 자이언트플러스 환경과 최대한 동일한 테스트 서버
|
||||
Tailscale 연동 (원격 접근)
|
||||
|
||||
|
||||
`
|
||||
````
|
||||
|
||||
---
|
||||
|
||||
## 디렉토리 구조
|
||||
|
||||
`
|
||||
```
|
||||
maketestserver/
|
||||
README.md # 이 파일
|
||||
dotfiles/ # git 관리 설정 파일
|
||||
@ -37,7 +37,7 @@ maketestserver/
|
||||
install_php.sh # PHP 8.2/8.4 설치
|
||||
lxc/ # LXC 스크립트
|
||||
setup_mariadb.sh # MariaDB 10.6 설정
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -46,7 +46,7 @@ maketestserver/
|
||||
### 1 Proxmox에서 VM 생성
|
||||
|
||||
#### VM1 (PHP 8.2)
|
||||
`bash
|
||||
```bash
|
||||
# Proxmox 호스트에서 실행
|
||||
qm create 101 \
|
||||
--name vm1-php82 \
|
||||
@ -58,10 +58,10 @@ qm create 101 \
|
||||
--cdrom local:iso/Rocky-9.0-latest.iso
|
||||
|
||||
qm start 101
|
||||
`
|
||||
```
|
||||
|
||||
#### VM2 (PHP 8.4)
|
||||
`bash
|
||||
```bash
|
||||
qm create 102 \
|
||||
--name vm2-php84 \
|
||||
--memory 2048 \
|
||||
@ -72,7 +72,7 @@ qm create 102 \
|
||||
--cdrom local:iso/Rocky-9.0-latest.iso
|
||||
|
||||
qm start 102
|
||||
`
|
||||
```
|
||||
|
||||
**Rocky Linux 9 설치 시 주의:**
|
||||
- 설치 중 일반 사용자 생성 (예: 'firstgarden')
|
||||
@ -81,7 +81,7 @@ qm start 102
|
||||
|
||||
### 2 Proxmox에서 LXC 생성 (MariaDB)
|
||||
|
||||
`bash
|
||||
```bash
|
||||
# LXC 생성
|
||||
pct create 201 \
|
||||
local:vztmpl/rocky-9-default_9.0-1_amd64.tar.gz \
|
||||
@ -93,13 +93,13 @@ pct create 201 \
|
||||
|
||||
pct start 201
|
||||
pct enter 201 # LXC 진입
|
||||
`
|
||||
```
|
||||
|
||||
### 3 VM1 (PHP 8.2) 설정
|
||||
|
||||
SSH로 VM1에 접속한 후:
|
||||
|
||||
`bash
|
||||
```bash
|
||||
# 스크립트 다운로드
|
||||
cd ~
|
||||
git clone https://github.com/yourusername/cafe24-testserver.git
|
||||
@ -115,21 +115,21 @@ chmod +x vm/install_php.sh
|
||||
|
||||
# Apache 재시작
|
||||
sudo systemctl restart httpd
|
||||
`
|
||||
```
|
||||
|
||||
### 4 VM2 (PHP 8.4) 설정
|
||||
|
||||
VM1과 동일하게 진행하되, PHP 버전만 8.4로 변경:
|
||||
|
||||
`bash
|
||||
```bash
|
||||
./vm/install_php.sh 8.4
|
||||
`
|
||||
```
|
||||
|
||||
### 5 LXC (MariaDB) 설정
|
||||
|
||||
LXC에서 Root로 로그인한 후:
|
||||
|
||||
`bash
|
||||
```bash
|
||||
# 스크립트 다운로드
|
||||
cd /root
|
||||
curl -fsSL https://github.com/yourusername/cafe24-testserver/archive/main.tar.gz | tar xz
|
||||
@ -138,7 +138,7 @@ cd cafe24-testserver-main
|
||||
# MariaDB 설정 실행
|
||||
chmod +x lxc/setup_mariadb.sh
|
||||
./lxc/setup_mariadb.sh
|
||||
`
|
||||
```
|
||||
|
||||
**스크립트 실행 중 입력 항목:**
|
||||
- Linux 사용자 이름
|
||||
@ -163,10 +163,10 @@ chmod +x lxc/setup_mariadb.sh
|
||||
- firewalld 비활성화
|
||||
|
||||
**실행:**
|
||||
`bash
|
||||
```bash
|
||||
chmod +x vm/setup_common.sh
|
||||
./vm/setup_common.sh
|
||||
`
|
||||
```
|
||||
|
||||
**생성되는 디렉토리:**
|
||||
- '~/www' - 웹 루트 (권한: 750)
|
||||
@ -190,20 +190,20 @@ PHP 8.2 또는 8.4를 설치하고 PHP-FPM pool을 생성합니다.
|
||||
- 필수 확장: mysqlnd, pdo, mbstring, xml, gd, curl, opcache, soap, intl, zip, bcmath, bz2, imagick
|
||||
|
||||
**실행:**
|
||||
`bash
|
||||
```bash
|
||||
chmod +x vm/install_php.sh
|
||||
./vm/install_php.sh 8.2 # PHP 8.2
|
||||
./vm/install_php.sh 8.4 # PHP 8.4
|
||||
`
|
||||
```
|
||||
|
||||
**생성되는 파일:**
|
||||
- '/etc/php-fpm.d/.conf' - PHP-FPM pool 설정
|
||||
|
||||
**PHP 버전 확인:**
|
||||
`bash
|
||||
```bash
|
||||
php -v
|
||||
php-fpm -v
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -218,10 +218,10 @@ MariaDB 10.6을 설치하고 사용자/DB를 생성합니다.
|
||||
- 초기 보안 설정 (테스트 DB/계정 제거)
|
||||
|
||||
**실행:**
|
||||
`bash
|
||||
```bash
|
||||
chmod +x lxc/setup_mariadb.sh
|
||||
./lxc/setup_mariadb.sh
|
||||
`
|
||||
```
|
||||
|
||||
**대화형 입력:**
|
||||
1. Linux 사용자 이름 (권장: 첫 번째 설정한 사용자)
|
||||
@ -230,13 +230,13 @@ chmod +x lxc/setup_mariadb.sh
|
||||
4. Database 이름 (예: 'testdb')
|
||||
|
||||
**접속 확인 (VM에서):**
|
||||
`bash
|
||||
```bash
|
||||
# LXC IP 확인: pct exec 201 ip addr show eth0 | grep inet
|
||||
mysql -h <LXC_IP> -u <DB_USER> -p<DB_PW>
|
||||
|
||||
# 또는
|
||||
mysql -h 192.168.1.100 -u firstgarden -p
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -265,16 +265,16 @@ mysql -h 192.168.1.100 -u firstgarden -p
|
||||
원격에서 테스트 서버에 접근하려면:
|
||||
|
||||
### VM 및 LXC에 설치
|
||||
`bash
|
||||
```bash
|
||||
curl -fsSL https://tailscale.com/install.sh | sh
|
||||
sudo systemctl enable --now tailscaled
|
||||
|
||||
# 가입 및 네트워크 등록
|
||||
sudo tailscale up
|
||||
`
|
||||
```
|
||||
|
||||
### 접속
|
||||
`bash
|
||||
```bash
|
||||
# 각 호스트의 Tailscale IP 확인
|
||||
tailscale ip
|
||||
|
||||
@ -283,7 +283,7 @@ ssh firstgarden@100.x.x.x
|
||||
|
||||
# MySQL 접속
|
||||
mysql -h 100.x.x.x -u firstgarden -p
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -296,7 +296,7 @@ mysql -h 100.x.x.x -u firstgarden -p
|
||||
- **firewalld:** 비활성화 (테스트 환경용)
|
||||
|
||||
### 프로덕션 권장사항
|
||||
`bash
|
||||
```bash
|
||||
# SSH 공개키 인증 설정
|
||||
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
|
||||
|
||||
@ -313,7 +313,7 @@ sudo nano /etc/ssh/sshd_config
|
||||
# PermitRootLogin no
|
||||
|
||||
sudo systemctl restart sshd
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -321,26 +321,26 @@ sudo systemctl restart sshd
|
||||
|
||||
### PHP-FPM 튜닝
|
||||
'/etc/php-fpm.d/.conf' 수정:
|
||||
`ini
|
||||
```ini
|
||||
pm.max_children = 20 # 최대 프로세스 (RAM에 따라)
|
||||
pm.start_servers = 5
|
||||
pm.min_spare_servers = 2
|
||||
pm.max_spare_servers = 10
|
||||
`
|
||||
```
|
||||
|
||||
### MariaDB 튜닝
|
||||
'/etc/my.cnf.d/50-server.cnf' 수정:
|
||||
`ini
|
||||
```ini
|
||||
max_connections = 200
|
||||
innodb_buffer_pool_size = 512M
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 문제 해결
|
||||
|
||||
### Apache 403 Forbidden
|
||||
`bash
|
||||
```bash
|
||||
# 웹 루트 권한 확인
|
||||
ls -ld ~/www
|
||||
# 예상: drwxr-x--- (750)
|
||||
@ -350,10 +350,10 @@ ps aux | grep apache
|
||||
|
||||
# SELinux 컨텍스트 확인
|
||||
ls -Z ~/www
|
||||
`
|
||||
```
|
||||
|
||||
### PHP-FPM 연결 실패
|
||||
`bash
|
||||
```bash
|
||||
# PHP-FPM 상태 확인
|
||||
sudo systemctl status php-fpm
|
||||
|
||||
@ -362,10 +362,10 @@ ls -l /run/php-fpm/.sock
|
||||
|
||||
# Apache에서 PHP 핸들러 설정 확인
|
||||
grep -r "proxy_fcgi" /etc/httpd/conf.d/
|
||||
`
|
||||
```
|
||||
|
||||
### MariaDB 연결 실패
|
||||
`bash
|
||||
```bash
|
||||
# MariaDB 상태 확인
|
||||
sudo systemctl status mariadb
|
||||
|
||||
@ -377,7 +377,7 @@ sudo ss -tlnp | grep 3306
|
||||
|
||||
# 방화벽 확인 (LXC)
|
||||
sudo firewall-cmd --list-ports
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -406,11 +406,11 @@ sudo firewall-cmd --list-ports
|
||||
### 파일 권한
|
||||
|
||||
스크립트 실행 가능 권한 설정:
|
||||
`bash
|
||||
```bash
|
||||
chmod +x vm/setup_common.sh
|
||||
chmod +x vm/install_php.sh
|
||||
chmod +x lxc/setup_mariadb.sh
|
||||
`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user