리눅스3 nginx 로그 (실제 IP 표출 설정) nginx.conf 파일에 추가 ## # Real IP Configuration (to get actual client IP) ## set_real_ip_from 0.0.0.0/0; # 모든 IP에서 X-Forwarded-For 헤더 사용 real_ip_header X-Forwarded-For; # X-Forwarded-For 헤더에서 실제 클라이언트 IP 추출 ## # Logging format to include real client IP ## log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_.. 2025. 2. 3. nginx 기본 보안 설정 (디도스 등) sites-enabled 폴더 내부 파일 설정 # 요청 속도 제한 (초당 10개 요청)limit_req_zone $binary_remote_addr zone=req_limit:10m rate=10r/s;# 동시 연결 수 제한 (IP당 최대 10개 동시 연결)limit_conn_zone $binary_remote_addr zone=conn_limit:10m;location / { limit_req zone=req_limit burst=20 nodelay; # 초당 10개 요청, 최대 20개 버스트 허용 limit_conn conn_limit 10; # 동시 10개 연결 제한}# 환경 설정 파일 접근 차단location ~* (\.env|\.git|\.htaccess) { deny all; .. 2025. 2. 3. oom(out of memory) 방지 스왑 메모리 설정 sudo fallocate -l 1G /swapfile # 1GB 스왑 파일 생성 sudo chmod 600 /swapfile # 스왑 파일의 권한 설정 (보안을 위해) sudo mkswap /swapfile # 스왑 파일 포맷 sudo swapon /swapfile # 스왑 활성화 echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab #재부팅시 스왑메모리 설정 유지 2024. 8. 26. 이전 1 다음