<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Debug Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/debug/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Tue, 25 Nov 2025 14:58:38 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>Debug Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Apache Virtual Host Guide (Apache 가상 호스트 설정)</title>
		<link>https://lycos7560.com/ubuntu/apache-%ea%b0%80%ec%83%81%ed%98%b8%ec%8a%a4%ed%8a%b8-%ec%84%a4%ec%a0%95-%ea%b0%80%ec%9d%b4%eb%93%9c/40358/</link>
					<comments>https://lycos7560.com/ubuntu/apache-%ea%b0%80%ec%83%81%ed%98%b8%ec%8a%a4%ed%8a%b8-%ec%84%a4%ec%a0%95-%ea%b0%80%ec%9d%b4%eb%93%9c/40358/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 25 Nov 2025 14:56:56 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[기타]]></category>
		<category><![CDATA[301Redirect]]></category>
		<category><![CDATA[301리다이렉트]]></category>
		<category><![CDATA[403Forbidden]]></category>
		<category><![CDATA[404NotFound]]></category>
		<category><![CDATA[500Error]]></category>
		<category><![CDATA[502Error]]></category>
		<category><![CDATA[503Error]]></category>
		<category><![CDATA[504GatewayTimeout]]></category>
		<category><![CDATA[AccessControl]]></category>
		<category><![CDATA[AccessLog]]></category>
		<category><![CDATA[AllowOverride]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache2]]></category>
		<category><![CDATA[ApacheModules]]></category>
		<category><![CDATA[ARecord]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Backend]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[BasicAuth]]></category>
		<category><![CDATA[BestPractices]]></category>
		<category><![CDATA[Brotli]]></category>
		<category><![CDATA[BrowserCache]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Certbot]]></category>
		<category><![CDATA[Cheatsheet]]></category>
		<category><![CDATA[chmod]]></category>
		<category><![CDATA[Chown]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Clustering]]></category>
		<category><![CDATA[CNAME]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[ConfigTest]]></category>
		<category><![CDATA[CrtFile]]></category>
		<category><![CDATA[CSR]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[Curl]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[DirectoryIndex]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[DocumentRoot]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[ErrorLog]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[Flask]]></category>
		<category><![CDATA[FreeSSL]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Gzip]]></category>
		<category><![CDATA[HighAvailability]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[HSTS]]></category>
		<category><![CDATA[htpasswd]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[HTTP2]]></category>
		<category><![CDATA[HTTP3]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[Iptables]]></category>
		<category><![CDATA[Journalctl]]></category>
		<category><![CDATA[KeepAlive]]></category>
		<category><![CDATA[KeyFile]]></category>
		<category><![CDATA[LetsEncrypt]]></category>
		<category><![CDATA[LinuxCommands]]></category>
		<category><![CDATA[LinuxServer]]></category>
		<category><![CDATA[LoadBalancing]]></category>
		<category><![CDATA[LoadTest]]></category>
		<category><![CDATA[LogAnalysis]]></category>
		<category><![CDATA[Manual]]></category>
		<category><![CDATA[mod_deflate]]></category>
		<category><![CDATA[mod_expires]]></category>
		<category><![CDATA[mod_headers]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[mod_ssl]]></category>
		<category><![CDATA[MPM]]></category>
		<category><![CDATA[MPM_Event]]></category>
		<category><![CDATA[MPM_Worker]]></category>
		<category><![CDATA[NameServer]]></category>
		<category><![CDATA[netstat]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[Nodejs]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[PemFile]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Permission]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[PortForwarding]]></category>
		<category><![CDATA[PrivateKey]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[ProxyPass]]></category>
		<category><![CDATA[ProxyPassReverse]]></category>
		<category><![CDATA[PublicKey]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Redirect]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[RequireAllGranted]]></category>
		<category><![CDATA[Restore]]></category>
		<category><![CDATA[ReverseProxy]]></category>
		<category><![CDATA[Rewrite]]></category>
		<category><![CDATA[RewriteRule]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SelfSigned]]></category>
		<category><![CDATA[ServerConfig]]></category>
		<category><![CDATA[ServerMaintenance]]></category>
		<category><![CDATA[ServerMigration]]></category>
		<category><![CDATA[ServerMonitoring]]></category>
		<category><![CDATA[ServerName]]></category>
		<category><![CDATA[Service]]></category>
		<category><![CDATA[SpeedUp]]></category>
		<category><![CDATA[ss]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[subdomain]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[systemd]]></category>
		<category><![CDATA[TCP]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[TUTORIAL]]></category>
		<category><![CDATA[UbuntuServer]]></category>
		<category><![CDATA[ufw]]></category>
		<category><![CDATA[URLRewrite]]></category>
		<category><![CDATA[Vhost]]></category>
		<category><![CDATA[VirtualHost]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[WAS]]></category>
		<category><![CDATA[WebAdmin]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[WebPerformance]]></category>
		<category><![CDATA[WebSecurity]]></category>
		<category><![CDATA[WebServer]]></category>
		<category><![CDATA[WebSocket]]></category>
		<category><![CDATA[Wget]]></category>
		<category><![CDATA[WSS]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[가상호스트]]></category>
		<category><![CDATA[가이드]]></category>
		<category><![CDATA[고가용성]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[권한설정]]></category>
		<category><![CDATA[기본인증]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[네임서버]]></category>
		<category><![CDATA[네트워크]]></category>
		<category><![CDATA[데비안]]></category>
		<category><![CDATA[뎁스옵스]]></category>
		<category><![CDATA[도메인]]></category>
		<category><![CDATA[디버깅]]></category>
		<category><![CDATA[레퍼런스]]></category>
		<category><![CDATA[렛츠인크립트]]></category>
		<category><![CDATA[로그분석]]></category>
		<category><![CDATA[로드밸런싱]]></category>
		<category><![CDATA[리눅스명령어]]></category>
		<category><![CDATA[리눅스서버]]></category>
		<category><![CDATA[리다이렉트]]></category>
		<category><![CDATA[리버스프록시]]></category>
		<category><![CDATA[매뉴얼]]></category>
		<category><![CDATA[명령어]]></category>
		<category><![CDATA[모범사례]]></category>
		<category><![CDATA[무료인증서]]></category>
		<category><![CDATA[문제해결]]></category>
		<category><![CDATA[방화벽]]></category>
		<category><![CDATA[백업]]></category>
		<category><![CDATA[백엔드]]></category>
		<category><![CDATA[보안]]></category>
		<category><![CDATA[복구]]></category>
		<category><![CDATA[부하테스트]]></category>
		<category><![CDATA[브라우저캐시]]></category>
		<category><![CDATA[사설인증서]]></category>
		<category><![CDATA[사용법]]></category>
		<category><![CDATA[서버모니터링]]></category>
		<category><![CDATA[서버설정]]></category>
		<category><![CDATA[서버유지보수]]></category>
		<category><![CDATA[서버이전]]></category>
		<category><![CDATA[서브도메인]]></category>
		<category><![CDATA[설정확인]]></category>
		<category><![CDATA[성능최적화]]></category>
		<category><![CDATA[속도향상]]></category>
		<category><![CDATA[시스템관리]]></category>
		<category><![CDATA[아파치]]></category>
		<category><![CDATA[아파치2]]></category>
		<category><![CDATA[아파치모듈]]></category>
		<category><![CDATA[압축]]></category>
		<category><![CDATA[액세스로그]]></category>
		<category><![CDATA[에러로그]]></category>
		<category><![CDATA[우분투]]></category>
		<category><![CDATA[웹개발]]></category>
		<category><![CDATA[웹보안]]></category>
		<category><![CDATA[웹서버]]></category>
		<category><![CDATA[웹성능]]></category>
		<category><![CDATA[웹소켓]]></category>
		<category><![CDATA[웹어드민]]></category>
		<category><![CDATA[웹호스팅]]></category>
		<category><![CDATA[인증서]]></category>
		<category><![CDATA[인프라]]></category>
		<category><![CDATA[접근제어]]></category>
		<category><![CDATA[최적화]]></category>
		<category><![CDATA[치트시트]]></category>
		<category><![CDATA[캐싱]]></category>
		<category><![CDATA[클라우드]]></category>
		<category><![CDATA[클러스터링]]></category>
		<category><![CDATA[터미널]]></category>
		<category><![CDATA[튜토리얼]]></category>
		<category><![CDATA[포트]]></category>
		<category><![CDATA[포트포워딩]]></category>
		<category><![CDATA[프록시]]></category>
		<category><![CDATA[확장성]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=40358</guid>

					<description><![CDATA[<p>기본 설정 확인 Apache 상태 및 설정 검증 필수 모듈 활성화 가상호스트 생성 1. 설정 파일 생성 2. 기본 HTTP 가상호스트 3. HTTP → HTTPS 리다이렉트 4. HTTPS 가상호스트 (정적 파일) 다양한 설정 예제 리버스 프록시 WebSocket 프록시 여러 백엔드로 로드 밸런싱 경로별 다른 백엔드 라우팅 특정 IP만 접근 허용 SSL/HTTPS 설정 Certbot으로 SSL 인증서 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/ubuntu/apache-%ea%b0%80%ec%83%81%ed%98%b8%ec%8a%a4%ed%8a%b8-%ec%84%a4%ec%a0%95-%ea%b0%80%ec%9d%b4%eb%93%9c/40358/">Apache Virtual Host Guide (Apache 가상 호스트 설정)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-692d8850      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#기본-설정-확인" class="uagb-toc-link__trigger">기본 설정 확인</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#apache-상태-및-설정-검증" class="uagb-toc-link__trigger">Apache 상태 및 설정 검증</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#필수-모듈-활성화" class="uagb-toc-link__trigger">필수 모듈 활성화</a></li></ul></li><li class="uagb-toc__list"><a href="#가상호스트-생성" class="uagb-toc-link__trigger">가상호스트 생성</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#1-설정-파일-생성" class="uagb-toc-link__trigger">1. 설정 파일 생성</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#2-기본-http-가상호스트" class="uagb-toc-link__trigger">2. 기본 HTTP 가상호스트</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#3-http-https-리다이렉트" class="uagb-toc-link__trigger">3. HTTP → HTTPS 리다이렉트</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#4-https-가상호스트-정적-파일" class="uagb-toc-link__trigger">4. HTTPS 가상호스트 (정적 파일)</a></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#다양한-설정-예제" class="uagb-toc-link__trigger">다양한 설정 예제</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#리버스-프록시" class="uagb-toc-link__trigger">리버스 프록시</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#websocket-프록시" class="uagb-toc-link__trigger">WebSocket 프록시</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#여러-백엔드로-로드-밸런싱" class="uagb-toc-link__trigger">여러 백엔드로 로드 밸런싱</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#경로별-다른-백엔드-라우팅" class="uagb-toc-link__trigger">경로별 다른 백엔드 라우팅</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#특정-ip만-접근-허용" class="uagb-toc-link__trigger">특정 IP만 접근 허용</a></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#sslhttps-설정" class="uagb-toc-link__trigger">SSL/HTTPS 설정</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#certbot으로-ssl-인증서-발급" class="uagb-toc-link__trigger">Certbot으로 SSL 인증서 발급</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#ssl-설정-최적화" class="uagb-toc-link__trigger">SSL 설정 최적화</a></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#가상호스트-관리" class="uagb-toc-link__trigger">가상호스트 관리</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#활성화비활성화" class="uagb-toc-link__trigger">활성화/비활성화</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#모듈-관리" class="uagb-toc-link__trigger">모듈 관리</a></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#문제-해결" class="uagb-toc-link__trigger">문제 해결</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#로그-확인" class="uagb-toc-link__trigger">로그 확인</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#연결-테스트" class="uagb-toc-link__trigger">연결 테스트</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#포트-및-프로세스-확인" class="uagb-toc-link__trigger">포트 및 프로세스 확인</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#일반적인-문제-해결" class="uagb-toc-link__trigger">일반적인 문제 해결</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#보안-강화" class="uagb-toc-link__trigger">보안 강화</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#보안-헤더-설정" class="uagb-toc-link__trigger">보안 헤더 설정</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#접근-제어" class="uagb-toc-link__trigger">접근 제어</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#htpasswd-파일-생성" class="uagb-toc-link__trigger">.htpasswd 파일 생성</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#rate-limiting-mod-ratelimit" class="uagb-toc-link__trigger">Rate Limiting (mod_ratelimit)</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#성능-최적화" class="uagb-toc-link__trigger">성능 최적화</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#캐싱-설정" class="uagb-toc-link__trigger">캐싱 설정</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#gzip-brotli-압축" class="uagb-toc-link__trigger">Gzip &amp; Brotli 압축</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#keepalive-설정" class="uagb-toc-link__trigger">KeepAlive 설정</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#mpm-설정-최적화" class="uagb-toc-link__trigger">MPM 설정 최적화</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#디렉토리-구조" class="uagb-toc-link__trigger">디렉토리 구조</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#apache-설정-파일-구조" class="uagb-toc-link__trigger">Apache 설정 파일 구조</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#웹-컨텐츠-디렉토리" class="uagb-toc-link__trigger">웹 컨텐츠 디렉토리</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#유용한-명령어-모음" class="uagb-toc-link__trigger">유용한 명령어 모음</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#빠른-참조" class="uagb-toc-link__trigger">빠른 참조</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#자주-사용하는-작업" class="uagb-toc-link__trigger">자주 사용하는 작업</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#문제-상황별-체크리스트" class="uagb-toc-link__trigger">문제 상황별 체크리스트</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#사이트가-접속되지-않을-때" class="uagb-toc-link__trigger">사이트가 접속되지 않을 때</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#502-bad-gateway-발생-시" class="uagb-toc-link__trigger">502 Bad Gateway 발생 시</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#ssl-인증서-오류-시" class="uagb-toc-link__trigger">SSL 인증서 오류 시</a></ul></ul></ul></ul></ul></ul></ul></ul></ul></ul></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">기본 설정 확인</h2>



<h3 class="wp-block-heading">Apache 상태 및 설정 검증</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Apache 서비스 상태 확인
sudo systemctl status apache2

# 설정 파일 문법 검사
sudo apache2ctl configtest

# 활성화된 가상호스트 목록 확인
sudo apache2ctl -S

# Apache 버전 확인
apache2 -v

# 로드된 모듈 확인
apache2ctl -M
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">필수 모듈 활성화</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 프록시 및 SSL 관련 모듈 활성화
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod headers

# 변경사항 적용
sudo systemctl restart apache2
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">가상호스트 생성</h2>



<h3 class="wp-block-heading">1. 설정 파일 생성</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 새 가상호스트 설정 파일 생성
sudo vim /etc/apache2/sites-available/testdomain.conf
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">2. 기본 HTTP 가상호스트</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:80>
    ServerName testdomain.com
    ServerAlias www.testdomain.com
    ServerAdmin admin@testdomain.com
    
    DocumentRoot /var/www/testdomain
    
    &lt;Directory /var/www/testdomain>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    &lt;/Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/testdomain_error.log
    CustomLog ${APACHE_LOG_DIR}/testdomain_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">3. HTTP → HTTPS 리다이렉트</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:80>
    ServerName testdomain.com
    ServerAlias www.testdomain.com
    
    # 모든 HTTP 요청을 HTTPS로 리다이렉트
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
    
    ErrorLog ${APACHE_LOG_DIR}/testdomain_http_error.log
    CustomLog ${APACHE_LOG_DIR}/testdomain_http_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">4. HTTPS 가상호스트 (정적 파일)</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName testdomain.com
    ServerAlias www.testdomain.com
    ServerAdmin admin@testdomain.com
    
    DocumentRoot /var/www/testdomain
    
    &lt;Directory /var/www/testdomain>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    &lt;/Directory>
    
    # SSL 설정
    SSLEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/testdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/testdomain.com/privkey.pem
    
    # 보안 헤더
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    Header always set X-Content-Type-Options nosniff
    Header always set X-Frame-Options SAMEORIGIN
    Header always set X-XSS-Protection "1; mode=block"
    
    ErrorLog ${APACHE_LOG_DIR}/testdomain_https_error.log
    CustomLog ${APACHE_LOG_DIR}/testdomain_https_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">다양한 설정 예제</h2>



<h3 class="wp-block-heading">리버스 프록시 </h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName api.testdomain.com
    
    # SSL 설정
    SSLEngine on
    SSLProxyEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/api.testdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/api.testdomain.com/privkey.pem
    
    # 프록시 설정
    ProxyPreserveHost On
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
    
    # 프록시 헤더 설정
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    ProxyAddHeaders On
    
    # 타임아웃 설정
    ProxyTimeout 300
    
    # 요청 크기 제한 해제
    LimitRequestBody 0
    LimitRequestLine 65536
    LimitRequestFieldSize 65536
    
    ErrorLog ${APACHE_LOG_DIR}/api_error.log
    CustomLog ${APACHE_LOG_DIR}/api_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">WebSocket 프록시</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName ws.testdomain.com
    
    SSLEngine on
    SSLProxyEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/ws.testdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/ws.testdomain.com/privkey.pem
    
    # WebSocket 지원을 위한 프록시 설정
    ProxyPreserveHost On
    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.*)           ws://localhost:8080/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /(.*)           http://localhost:8080/$1 [P,L]
    
    ProxyPassReverse / http://localhost:8080/
    
    ErrorLog ${APACHE_LOG_DIR}/ws_error.log
    CustomLog ${APACHE_LOG_DIR}/ws_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">여러 백엔드로 로드 밸런싱</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;Proxy balancer://mycluster>
    BalancerMember http://localhost:3001
    BalancerMember http://localhost:3002
    BalancerMember http://localhost:3003
    ProxySet lbmethod=byrequests
&lt;/Proxy>

&lt;VirtualHost *:443>
    ServerName testdomain.com
    
    SSLEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/testdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/testdomain.com/privkey.pem
    
    ProxyPreserveHost On
    ProxyPass / balancer://mycluster/
    ProxyPassReverse / balancer://mycluster/
    
    ErrorLog ${APACHE_LOG_DIR}/testdomain_error.log
    CustomLog ${APACHE_LOG_DIR}/testdomain_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">경로별 다른 백엔드 라우팅</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName testdomain.com
    
    SSLEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/testdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/testdomain.com/privkey.pem
    
    # API 요청은 백엔드 서버로
    ProxyPass /api http://localhost:8000/api
    ProxyPassReverse /api http://localhost:8000/api
    
    # 정적 파일은 직접 제공
    DocumentRoot /var/www/testdomain
    &lt;Directory /var/www/testdomain>
        Require all granted
    &lt;/Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/testdomain_error.log
    CustomLog ${APACHE_LOG_DIR}/testdomain_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">특정 IP만 접근 허용</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName admin.testdomain.com
    
    SSLEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/admin.testdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/admin.testdomain.com/privkey.pem
    
    DocumentRoot /var/www/admin
    
    &lt;Directory /var/www/admin>
        # 특정 IP만 허용
        Require ip 192.168.1.0/24
        Require ip 10.0.0.5
    &lt;/Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/admin_error.log
    CustomLog ${APACHE_LOG_DIR}/admin_access.log combined
&lt;/VirtualHost>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">SSL/HTTPS 설정</h2>



<h3 class="wp-block-heading">Certbot으로 SSL 인증서 발급</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 자동 설정 (권장)
sudo certbot --apache -d testdomain.com -d www.testdomain.com

# 인증서만 발급 (수동 설정)
sudo certbot certonly --standalone -d testdomain.com -d www.testdomain.com

# 와일드카드 인증서 발급
sudo certbot certonly --manual --preferred-challenges dns -d testdomain.com -d *.testdomain.com

# 인증서 갱신 테스트
sudo certbot renew --dry-run

# 인증서 강제 갱신
sudo certbot renew --force-renewal

# 인증서 자동 갱신 크론잡 설정
sudo crontab -e
# 매일 새벽 2시에 갱신 확인
0 2 * * * certbot renew --quiet
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">SSL 설정 최적화</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># /etc/letsencrypt/options-ssl-apache.conf 참고
# 또는 직접 설정

SSLEngine on
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder off
SSLSessionTickets off

# OCSP Stapling 활성화
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">가상호스트 관리</h2>



<h3 class="wp-block-heading">활성화/비활성화</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 가상호스트 활성화
sudo a2ensite testdomain.conf

# 가상호스트 비활성화
sudo a2dissite testdomain.conf

# 기본 사이트 비활성화
sudo a2dissite 000-default.conf

# 설정 적용 (다운타임 없음)
sudo systemctl reload apache2

# 설정 재시작 (다운타임 발생)
sudo systemctl restart apache2
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">모듈 관리</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 모듈 활성화
sudo a2enmod 모듈명

# 모듈 비활성화
sudo a2dismod 모듈명

# 자주 사용하는 모듈들
sudo a2enmod rewrite      # URL 재작성
sudo a2enmod headers      # HTTP 헤더 조작
sudo a2enmod proxy        # 프록시 기능
sudo a2enmod proxy_http   # HTTP 프록시
sudo a2enmod proxy_wstunnel  # WebSocket 프록시
sudo a2enmod ssl          # SSL/TLS
sudo a2enmod deflate      # 압축
sudo a2enmod expires      # 캐시 제어
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제 해결</h2>



<h3 class="wp-block-heading">로그 확인</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 실시간 에러 로그 모니터링
sudo tail -f /var/log/apache2/error.log

# 실시간 액세스 로그 모니터링
sudo tail -f /var/log/apache2/access.log

# 특정 가상호스트 로그
sudo tail -f /var/log/apache2/testdomain_error.log

# 마지막 100줄 확인
sudo tail -100 /var/log/apache2/error.log

# 특정 키워드로 검색
sudo grep "testdomain" /var/log/apache2/*.log

# 에러만 필터링
sudo grep "error" /var/log/apache2/error.log

# 최근 에러 (systemd)
sudo journalctl -u apache2 -n 50
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">연결 테스트</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># HTTP 응답 헤더 확인
curl -I http://testdomain.com/

# HTTPS 응답 헤더 확인
curl -I https://testdomain.com/

# 상세 디버깅 정보
curl -v https://testdomain.com/

# POST 요청 테스트
curl -X POST https://testdomain.com/api/endpoint \
  -H "Content-Type: application/json" \
  -d '{"key":"value"}'

# SSL 인증서 정보 확인
openssl s_client -connect testdomain.com:443 -servername testdomain.com &lt; /dev/null

# 백엔드 서비스 테스트
curl -v http://localhost:3000/
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">포트 및 프로세스 확인</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 특정 포트 사용 확인
sudo netstat -tlnp | grep :80
sudo netstat -tlnp | grep :443
sudo netstat -tlnp | grep :3000

# 또는 ss 명령어 사용 (더 빠름)
sudo ss -tlnp | grep :80

# Apache 프로세스 확인
ps aux | grep apache2

# 열린 파일 확인
sudo lsof -i :80
sudo lsof -i :443
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">일반적인 문제 해결</h3>



<h4 class="wp-block-heading">포트 충돌 문제 체크</h4>



<p class="wp-block-paragraph">Apache + Nginx 동시 사용 시 자주 발생<br>특히 Certbot &#8211;apache 사용 시 충돌할 수 있음.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo ss -tlnp | grep :80
sudo ss -tlnp | grep :443

// 만약 Nginx가 잡고 있다면
sudo systemctl stop nginx
sudo systemctl disable nginx
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">403 Forbidden 오류</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Directory 권한 확인
&lt;Directory /var/www/testdomain>
    Require all granted
    # 또는
    Options +Indexes
&lt;/Directory>

# 파일 시스템 권한 확인
sudo chmod -R 755 /var/www/testdomain
sudo chown -R www-data:www-data /var/www/testdomain
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">500 Internal Server Error</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 설정 문법 오류 확인
sudo apache2ctl configtest

# .htaccess 문제 확인
sudo tail -50 /var/log/apache2/error.log

# SELinux 확인 (CentOS/RHEL)
sudo setenforce 0  # 임시 비활성화
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">SSL 인증서 오류</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 인증서 파일 존재 확인
ls -la /etc/letsencrypt/live/testdomain.com/

# 인증서 유효기간 확인
sudo certbot certificates

# 인증서 갱신
sudo certbot renew

# SSL 인증서 권한 변경 주의
# SSLCertificateFile: file '/etc/letsencrypt/live/.../fullchain.pem' does not exist or is empty // 원인은 보통 인증서 폴더 권한 문제

sudo chmod 755 /etc/letsencrypt/live
sudo chmod 644 /etc/letsencrypt/live/DOMAIN/fullchain.pem
sudo chmod 600 /etc/letsencrypt/live/DOMAIN/privkey.pem

</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">프록시 오류 (502 Bad Gateway)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 백엔드 서비스 작동 확인
curl http://localhost:3000/

# SELinux 설정 (CentOS/RHEL)
sudo setsebool -P httpd_can_network_connect 1

# 프록시 타임아웃 늘리기
ProxyTimeout 600
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">Proxy 헤더 관련 ForwardedHeaders 추가</h4>



<p class="wp-block-paragraph">ASP.NET Core, Node.js, Django 모두 HTTPS 프록시 환경에서 필수</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Host %{HTTP_HOST}s

# (예시) ASP.NET Core
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
    ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">보안 강화</h2>



<h3 class="wp-block-heading">보안 헤더 설정</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName testdomain.com
    
    # ... SSL 설정 ...
    
    # HSTS (HTTP Strict Transport Security)
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    
    # XSS 방지
    Header always set X-XSS-Protection "1; mode=block"
    
    # MIME 타입 스니핑 방지
    Header always set X-Content-Type-Options "nosniff"
    
    # 클릭재킹 방지
    Header always set X-Frame-Options "SAMEORIGIN"
    
    # Referrer 정책
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
    
    # CSP (Content Security Policy)
    Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';"
    
    # 서버 정보 숨기기
    ServerTokens Prod
    ServerSignature Off
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">접근 제어</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># IP 기반 접근 제어
&lt;Directory /var/www/admin>
    # 특정 IP만 허용
    Require ip 192.168.1.0/24
    Require ip 10.0.0.5
    
    # 또는 특정 IP 차단
    Require all granted
    Require not ip 192.168.1.100
&lt;/Directory>

# HTTP Basic 인증
&lt;Directory /var/www/protected>
    AuthType Basic
    AuthName "Restricted Area"
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user
&lt;/Directory>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">.htpasswd 파일 생성</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># htpasswd 파일 생성 (첫 사용자)
sudo htpasswd -c /etc/apache2/.htpasswd username

# 추가 사용자 등록 (-c 옵션 제거)
sudo htpasswd /etc/apache2/.htpasswd username2
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Rate Limiting (mod_ratelimit)</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;Location /api>
    SetOutputFilter RATE_LIMIT
    SetEnv rate-limit 400
    SetEnv rate-initial-burst 100
&lt;/Location>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">성능 최적화</h2>



<h3 class="wp-block-heading">캐싱 설정</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;VirtualHost *:443>
    ServerName testdomain.com
    
    # ... 기본 설정 ...
    
    # 정적 파일 캐싱
    &lt;IfModule mod_expires.c>
        ExpiresActive On
        
        # 이미지
        ExpiresByType image/jpg "access plus 1 year"
        ExpiresByType image/jpeg "access plus 1 year"
        ExpiresByType image/gif "access plus 1 year"
        ExpiresByType image/png "access plus 1 year"
        ExpiresByType image/webp "access plus 1 year"
        ExpiresByType image/svg+xml "access plus 1 year"
        
        # CSS/JS
        ExpiresByType text/css "access plus 1 month"
        ExpiresByType application/javascript "access plus 1 month"
        
        # 폰트
        ExpiresByType font/woff2 "access plus 1 year"
        ExpiresByType font/woff "access plus 1 year"
        
        # HTML
        ExpiresByType text/html "access plus 1 hour"
    &lt;/IfModule>
    
    # Cache-Control 헤더
    &lt;FilesMatch "\.(jpg|jpeg|png|gif|webp|svg|css|js|woff|woff2)$">
        Header set Cache-Control "max-age=31536000, public"
    &lt;/FilesMatch>
&lt;/VirtualHost>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Gzip &amp; Brotli 압축</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;IfModule mod_deflate.c>
    # 압축 활성화
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
    AddOutputFilterByType DEFLATE application/javascript application/json
    AddOutputFilterByType DEFLATE application/xml application/xhtml+xml
    AddOutputFilterByType DEFLATE image/svg+xml
    
    # 이미지는 압축 제외 (이미 압축됨)
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|webp)$ no-gzip
&lt;/IfModule>


sudo apt install libapache2-mod-brotli
sudo a2enmod brotli

&lt;IfModule mod_brotli.c>
    BrotliCompressionQuality 5
    AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css application/javascript application/json image/svg+xml
&lt;/IfModule></pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">KeepAlive 설정</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># /etc/apache2/apache2.conf

# KeepAlive 활성화
KeepAlive On

# 최대 요청 수
MaxKeepAliveRequests 100

# 타임아웃 (초)
KeepAliveTimeout 5
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">MPM 설정 최적화</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># /etc/apache2/mods-available/mpm_event.conf

&lt;IfModule mpm_event_module>
    StartServers             2
    MinSpareThreads          25
    MaxSpareThreads          75
    ThreadLimit              64
    ThreadsPerChild          25
    MaxRequestWorkers        150
    MaxConnectionsPerChild   0
&lt;/IfModule>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">디렉토리 구조</h2>



<h3 class="wp-block-heading">Apache 설정 파일 구조</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">/etc/apache2/
├── apache2.conf              # 메인 설정 파일
├── ports.conf                # 포트 설정
├── conf-available/           # 사용 가능한 설정
├── conf-enabled/             # 활성화된 설정
├── mods-available/           # 사용 가능한 모듈
├── mods-enabled/             # 활성화된 모듈 (심볼릭 링크)
├── sites-available/          # 사용 가능한 가상호스트
│   ├── 000-default.conf
│   ├── testdomain.conf
│   └── api.testdomain.conf
├── sites-enabled/            # 활성화된 가상호스트 (심볼릭 링크)
│   ├── 000-default.conf -> ../sites-available/000-default.conf
│   └── testdomain.conf -> ../sites-available/testdomain.conf
└── envvars                   # 환경 변수
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">웹 컨텐츠 디렉토리</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">/var/www/
├── html/                     # 기본 DocumentRoot
├── testdomain/               # 가상호스트 디렉토리
│   ├── public/
│   ├── index.html
│   └── .htaccess
└── logs/                     # 로그 (선택사항)
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">유용한 명령어 모음</h2>



<h3 class="wp-block-heading">빠른 참조</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 설정 테스트
sudo apache2ctl configtest

# 가상호스트 목록
sudo apache2ctl -S

# 설정 리로드 (무중단)
sudo systemctl reload apache2

# 재시작
sudo systemctl restart apache2

# 상태 확인
sudo systemctl status apache2

# 로그 실시간 모니터링
sudo tail -f /var/log/apache2/error.log

# 특정 도메인 설정 확인
sudo apache2ctl -D DUMP_VHOSTS | grep testdomain

# 활성화된 모듈 목록
apache2ctl -M

# 설정 파일 문법 체크
sudo apachectl -t
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">자주 사용하는 작업</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 새 가상호스트 생성부터 활성화까지
sudo vim /etc/apache2/sites-available/newsite.conf
sudo a2ensite newsite.conf
sudo apache2ctl configtest
sudo systemctl reload apache2

# SSL 인증서 발급 및 자동 설정
sudo certbot --apache -d newsite.com

# 로그 분석
sudo tail -1000 /var/log/apache2/access.log | grep "POST" | wc -l

# 디스크 사용량 확인
sudo du -sh /var/log/apache2/*

# 오래된 로그 정리
sudo find /var/log/apache2/ -name "*.log.*" -mtime +30 -delete
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제 상황별 체크리스트</h2>



<h3 class="wp-block-heading">사이트가 접속되지 않을 때</h3>



<ul class="wp-block-list">
<li>[ ] Apache 서비스 작동 확인: <code>sudo systemctl status apache2</code></li>



<li>[ ] 포트 리스닝 확인: <code>sudo netstat -tlnp | grep :80</code></li>



<li>[ ] 방화벽 확인: <code>sudo ufw status</code></li>



<li>[ ] DNS 설정 확인: <code>nslookup testdomain.com</code></li>



<li>[ ] 가상호스트 활성화 확인: <code>sudo apache2ctl -S</code></li>



<li>[ ] 설정 문법 확인: <code>sudo apache2ctl configtest</code></li>
</ul>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">502 Bad Gateway 발생 시</h3>



<ul class="wp-block-list">
<li>[ ] 백엔드 서비스 작동 확인: <code>curl http://localhost:3000/</code></li>



<li>[ ] 프록시 설정 확인: ProxyPass, ProxyPassReverse</li>



<li>[ ] SELinux 설정 확인 (CentOS/RHEL)</li>



<li>[ ] 타임아웃 설정 확인: ProxyTimeout</li>



<li>[ ] 에러 로그 확인: <code>sudo tail -50 /var/log/apache2/error.log</code></li>
</ul>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">SSL 인증서 오류 시</h3>



<ul class="wp-block-list">
<li>[ ] 인증서 파일 존재 확인</li>



<li>[ ] 인증서 유효기간 확인: <code>sudo certbot certificates</code></li>



<li>[ ] 인증서 경로 확인</li>



<li>[ ] 포트 443 리스닝 확인</li>



<li>[ ] SSL 모듈 활성화 확인: <code>apache2ctl -M | grep ssl</code></li>
</ul>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://lycos7560.com/ubuntu/apache-%ea%b0%80%ec%83%81%ed%98%b8%ec%8a%a4%ed%8a%b8-%ec%84%a4%ec%a0%95-%ea%b0%80%ec%9d%b4%eb%93%9c/40358/">Apache Virtual Host Guide (Apache 가상 호스트 설정)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/ubuntu/apache-%ea%b0%80%ec%83%81%ed%98%b8%ec%8a%a4%ed%8a%b8-%ec%84%a4%ec%a0%95-%ea%b0%80%ec%9d%b4%eb%93%9c/40358/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Unity &#8211; Debug.Log 색상 변경</title>
		<link>https://lycos7560.com/unity/unity-debug-log-%ec%83%89%ec%83%81-%eb%b3%80%ea%b2%bd/35443/</link>
					<comments>https://lycos7560.com/unity/unity-debug-log-%ec%83%89%ec%83%81-%eb%b3%80%ea%b2%bd/35443/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sat, 13 May 2023 19:20:20 +0000</pubDate>
				<category><![CDATA[Unity]]></category>
		<category><![CDATA[Color]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Debug.Log]]></category>
		<category><![CDATA[Debug.Log 색상 변경]]></category>
		<category><![CDATA[변경]]></category>
		<category><![CDATA[색상]]></category>
		<category><![CDATA[유니티]]></category>
		<category><![CDATA[콘솔]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=35443</guid>

					<description><![CDATA[<p>Unity Console창에서 Debug.Log의 글자 색상을 변경하는 방법에 대한 글입니다.<br />
(This article describes how to change the color of the letters in Debug.Log in the Unity Console window.)</p>
<p>The post <a href="https://lycos7560.com/unity/unity-debug-log-%ec%83%89%ec%83%81-%eb%b3%80%ea%b2%bd/35443/">Unity &#8211; Debug.Log 색상 변경</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// Default
Debug.Log("Default");

Debug.Log("&lt;color=white>White&lt;/color>");
Debug.Log("&lt;color=grey>Grey&lt;/color>");
Debug.Log("&lt;color=black>Black&lt;/color>");
Debug.Log("&lt;color=red>Red&lt;/color>");
Debug.Log("&lt;color=green>Green&lt;/color>");
Debug.Log("&lt;color=blue>Blue&lt;/color>");
Debug.Log("&lt;color=yellow>Yellow&lt;/color>");
Debug.Log("&lt;color=cyan>Cyan&lt;/color>");
Debug.Log("&lt;color=brown>Brown&lt;/color>");

// Hex Color
Debug.Log("&lt;color=#fa56d6> Hex Color1 &lt;/color>");
Debug.Log("&lt;color=#74fa56> Hex Color1 &lt;/color>");
Debug.LogFormat("&lt;color=yellow> Yellow &lt;/color>" + "&lt;color=black> Black &lt;/color>");</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/06/image-29.png" alt="" class="wp-image-35445" width="1106" height="402" srcset="https://lycos7560.com/wp-content/uploads/2023/06/image-29.png 1475w, https://lycos7560.com/wp-content/uploads/2023/06/image-29-300x109.png 300w, https://lycos7560.com/wp-content/uploads/2023/06/image-29-768x279.png 768w" sizes="(max-width: 1106px) 100vw, 1106px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/unity/unity-debug-log-%ec%83%89%ec%83%81-%eb%b3%80%ea%b2%bd/35443/">Unity &#8211; Debug.Log 색상 변경</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/unity/unity-debug-log-%ec%83%89%ec%83%81-%eb%b3%80%ea%b2%bd/35443/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
