<?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>.htaccess Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Fri, 05 Dec 2025 12:21:43 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>.htaccess Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Nginx + Apache / Reverse Proxy</title>
		<link>https://lycos7560.com/ubuntu/nginx-apache-reverse-proxy/40373/</link>
					<comments>https://lycos7560.com/ubuntu/nginx-apache-reverse-proxy/40373/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 05 Dec 2025 12:18:49 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[기타]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[127.0.0.1]]></category>
		<category><![CDATA[301 redirect]]></category>
		<category><![CDATA[502 bad gateway]]></category>
		<category><![CDATA[a2dissite]]></category>
		<category><![CDATA[a2ensite]]></category>
		<category><![CDATA[access log]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[apache configuration]]></category>
		<category><![CDATA[apache modules]]></category>
		<category><![CDATA[apache reload]]></category>
		<category><![CDATA[apache virtualhost]]></category>
		<category><![CDATA[application server]]></category>
		<category><![CDATA[auto renewal]]></category>
		<category><![CDATA[Backend Server]]></category>
		<category><![CDATA[Caching Strategy]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Certbot]]></category>
		<category><![CDATA[Certificate Management]]></category>
		<category><![CDATA[connection pooling]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Decryption]]></category>
		<category><![CDATA[deny rules]]></category>
		<category><![CDATA[document root]]></category>
		<category><![CDATA[domain configuration]]></category>
		<category><![CDATA[downstream server]]></category>
		<category><![CDATA[dynamic content]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[error log]]></category>
		<category><![CDATA[file protection]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[frontend server]]></category>
		<category><![CDATA[gzip compression]]></category>
		<category><![CDATA[Header Manipulation]]></category>
		<category><![CDATA[host header]]></category>
		<category><![CDATA[HSTS]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[http to https]]></category>
		<category><![CDATA[HTTP2]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[https redirect]]></category>
		<category><![CDATA[internal port]]></category>
		<category><![CDATA[KeepAlive]]></category>
		<category><![CDATA[lamp stack]]></category>
		<category><![CDATA[lemp stack]]></category>
		<category><![CDATA[let's encrypt]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Load Balancing]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[location block]]></category>
		<category><![CDATA[Log Analysis]]></category>
		<category><![CDATA[mixed content]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[nginx configuration]]></category>
		<category><![CDATA[nginx modules]]></category>
		<category><![CDATA[nginx reload]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[permanent redirect]]></category>
		<category><![CDATA[php processing]]></category>
		<category><![CDATA[port configuration]]></category>
		<category><![CDATA[port forwarding]]></category>
		<category><![CDATA[port forwarding configuration]]></category>
		<category><![CDATA[proxy buffer]]></category>
		<category><![CDATA[proxy headers]]></category>
		<category><![CDATA[proxy pass]]></category>
		<category><![CDATA[proxy redirect]]></category>
		<category><![CDATA[proxy set header]]></category>
		<category><![CDATA[real ip]]></category>
		<category><![CDATA[redirect loop]]></category>
		<category><![CDATA[regex location]]></category>
		<category><![CDATA[remote addr]]></category>
		<category><![CDATA[Request Forwarding]]></category>
		<category><![CDATA[Reverse Proxy]]></category>
		<category><![CDATA[scheme forwarding]]></category>
		<category><![CDATA[security headers]]></category>
		<category><![CDATA[seo optimization]]></category>
		<category><![CDATA[server block]]></category>
		<category><![CDATA[Server Configuration]]></category>
		<category><![CDATA[server management]]></category>
		<category><![CDATA[server name]]></category>
		<category><![CDATA[server optimization]]></category>
		<category><![CDATA[sites-available]]></category>
		<category><![CDATA[sites-enabled]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[ssl certificate]]></category>
		<category><![CDATA[SSL Termination]]></category>
		<category><![CDATA[Static Files]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[symbolic link]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[tls termination]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[upstream server]]></category>
		<category><![CDATA[virtual host]]></category>
		<category><![CDATA[web architecture]]></category>
		<category><![CDATA[web hosting]]></category>
		<category><![CDATA[Web Performance]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[web stack]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress security]]></category>
		<category><![CDATA[wp-config]]></category>
		<category><![CDATA[x-content-type-options]]></category>
		<category><![CDATA[x-forwarded-for]]></category>
		<category><![CDATA[x-forwarded-proto]]></category>
		<category><![CDATA[X-Frame-Options]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=40373</guid>

					<description><![CDATA[<p>Nginx를 리버스 프록시로, Apache를 백엔드 웹서버로 사용하는 구성 방법 Nginx가 SSL/TLS 처리와 클라이언트 요청을 담당하고, Apache는 WordPress 애플리케이션을 실행 아키텍처 구조 1. WordPress 설정 파일 위치 wp-config.php (WordPress 루트 디렉토리) 설정 목적 Nginx 리버스 프록시 환경에서 WordPress가 HTTPS를 올바르게 인식하도록 설정 코드 추가 위치 /* That's all, stop editing! Happy blogging. */ 주석 위에 다음 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/ubuntu/nginx-apache-reverse-proxy/40373/">Nginx + Apache / Reverse Proxy</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-ad566142      "
					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><li class="uagb-toc__list"><a href="#1-wordpress-설정" class="uagb-toc-link__trigger">1. WordPress 설정</a><li class="uagb-toc__list"><a href="#2-nginx-설정" class="uagb-toc-link__trigger">2. Nginx 설정</a><li class="uagb-toc__list"><a href="#3-apache-설정" class="uagb-toc-link__trigger">3. Apache 설정</a><li class="uagb-toc__list"><a href="#4-전체-설정-흐름" class="uagb-toc-link__trigger">4. 전체 설정 흐름</a><li class="uagb-toc__list"><a href="#5-트러블슈팅" class="uagb-toc-link__trigger">5. 트러블슈팅</a><li class="uagb-toc__list"><a href="#6-보안-체크리스트" class="uagb-toc-link__trigger">6. 보안 체크리스트</a><li class="uagb-toc__list"><a href="#7-성능-최적화-팁" class="uagb-toc-link__trigger">7. 성능 최적화 팁</a><li class="uagb-toc__list"><a href="#참고-사항" class="uagb-toc-link__trigger">참고 사항</a></ol>					</div>
									</div>
				</div>
			


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



<p>Nginx를 리버스 프록시로, Apache를 백엔드 웹서버로 사용하는 구성 방법</p>



<p>Nginx가 SSL/TLS 처리와 클라이언트 요청을 담당하고, Apache는 WordPress 애플리케이션을 실행</p>



<ul class="wp-block-list">
<li><strong>Nginx</strong>: <br>&#8211; 정적 파일(이미지, CSS, JS) 처리에 매우 빠르고 동시 접속 처리에 강함<br>&#8211; Nginx는 Apache보다 훨씬 적은 메모리 사용<br>&#8211; Nginx는 이벤트 기반 구조로 수천 개의 동시 연결을 적은 리소스로 처리</li>



<li><strong>Apache</strong>: PHP 처리와 .htaccess 지원이 우수하고, WordPress 같은 PHP 애플리케이션과 호환성이 좋음</li>
</ul>



<h2 class="wp-block-heading">아키텍처 구조</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">클라이언트 → Nginx (80/443포트) → Apache (5050포트) → WordPress
           ↓
      SSL/TLS 처리
      HTTPS 강제
</pre>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h2 class="wp-block-heading">1. WordPress 설정</h2>



<h3 class="wp-block-heading">파일 위치</h3>



<p><code>wp-config.php</code> (WordPress 루트 디렉토리)</p>



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



<p>Nginx 리버스 프록시 환경에서 WordPress가 HTTPS를 올바르게 인식하도록 설정</p>



<h3 class="wp-block-heading">코드 추가 위치</h3>



<p><code>/* That's all, stop editing! Happy blogging. */</code> 주석 <strong>위에</strong> 다음 코드를 추가</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// Nginx 리버스 프록시 환경에서 HTTPS를 강제 인식시키는 코드
if (
    (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &amp;&amp; $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ||
    (isset($_SERVER['HTTP_X_FORWARDED_SSL']) &amp;&amp; $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on')
) {
    $_SERVER['HTTPS'] = 'on';
}
</pre>



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



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



<ul class="wp-block-list">
<li>Nginx가 전달하는 <code>X-Forwarded-Proto</code> 헤더를 확인</li>



<li>HTTPS 요청임을 감지하면 <code>$_SERVER['HTTPS']</code>를 <code>'on'</code>으로 설정</li>



<li>WordPress의 리다이렉트 루프 및 Mixed Content 문제 해결</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h2 class="wp-block-heading">2. Nginx 설정</h2>



<h3 class="wp-block-heading">파일 위치</h3>



<p><code>/etc/nginx/sites-available/test.conf</code></p>



<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 nginx -t

# 설정 활성화 (심볼릭 링크 생성)
sudo ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/

# 설정 비활성화 (심볼릭 링크 제거)
sudo rm /etc/nginx/sites-enabled/test.conf

# Nginx 상태 확인
sudo systemctl status nginx

# Nginx 재시작
sudo systemctl restart nginx
</pre>



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



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



<h4 class="wp-block-heading">(1) HTTP → HTTPS 리다이렉트 (포트 80)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">server {
    listen 80;
    listen [::]:80;
    server_name test.com www.test.com;

    # 모든 HTTP 요청을 HTTPS로 301 영구 이동
    return 301 https://$host$request_uri;
}
</pre>



<p><strong>기능:</strong></p>



<ul class="wp-block-list">
<li>모든 HTTP 요청을 HTTPS로 강제 리다이렉트</li>



<li>SEO 및 보안 향상</li>
</ul>



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



<h4 class="wp-block-heading">(2) HTTPS 요청 처리 및 프록시 (포트 443)</h4>



<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="">server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name test.com www.test.com;

    # SSL/TLS 인증서 설정 (Let's Encrypt)
    ssl_certificate /etc/letsencrypt/live/test.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/test.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;

    # 보안 헤더 설정
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options nosniff always;
    add_header X-Frame-Options SAMEORIGIN always;

    # Apache로 프록시
    location / {
        proxy_pass http://127.0.0.1:5050;
        
        # 클라이언트 원본 정보 전달
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        
        # HTTPS 정보 전달 (필수)
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port 443;
        
        proxy_redirect off;
    }

    # .ht 파일 보안 차단
    location ~ /\.ht {
        deny all;
    }
}
</pre>



<p><strong>주요 기능:</strong></p>



<ul class="wp-block-list">
<li><strong>SSL/TLS 처리</strong>: Nginx가 HTTPS 암호화/복호화 담당</li>



<li><strong>보안 헤더</strong>: HSTS, XSS 보호, 클릭재킹 방지</li>



<li><strong>프록시 헤더</strong>: Apache가 실제 클라이언트 정보를 알 수 있도록 전달</li>



<li><strong>X-Forwarded-Proto</strong>: WordPress가 HTTPS를 인식하는 데 필수</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50)"/>



<h2 class="wp-block-heading">3. Apache 설정</h2>



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



<p><strong>파일:</strong> <code>/etc/apache2/ports.conf</code></p>



<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="">Listen 5050
</pre>



<p><strong>설명:</strong></p>



<ul class="wp-block-list">
<li>Apache는 외부 접근 불가능한 내부 포트 5050에서만 대기</li>



<li>Nginx만 이 포트로 요청 전달 가능</li>
</ul>



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



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



<p><strong>파일:</strong> <code>/etc/apache2/sites-available/test.conf</code></p>



<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;VirtualHost *:5050>
    ServerName test.com
    ServerAlias www.test.com

    DocumentRoot /path/to/wordpress/

    ErrorLog ${APACHE_LOG_DIR}/test_error_444.log
    CustomLog ${APACHE_LOG_DIR}/test_access_444.log combined
&lt;/VirtualHost>
</pre>



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



<h3 class="wp-block-heading">주요 명령어</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=""># 사이트 활성화
sudo a2ensite test.conf

# 사이트 비활성화
sudo a2dissite test.conf

# Apache 설정 다시 로드
sudo systemctl reload apache2
</pre>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h2 class="wp-block-heading">4. 전체 설정 흐름</h2>



<h3 class="wp-block-heading">초기 설정 순서</h3>



<ol class="wp-block-list">
<li><strong>Apache 포트 변경</strong> <code>sudo vim /etc/apache2/ports.conf # Listen 5050 추가</code></li>



<li><strong>Apache VirtualHost 생성</strong> <code>sudo vim /etc/apache2/sites-available/test.conf sudo a2ensite test.conf sudo systemctl reload apache2</code></li>



<li><strong>WordPress 설정 수정</strong> <code>sudo vim /path/to/wordpress/wp-config.php # 프록시 인식 코드 추가</code></li>



<li><strong>Nginx 설정 생성</strong> <code>sudo vim /etc/nginx/sites-available/test.conf sudo nginx -t sudo ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/ sudo systemctl restart nginx</code></li>



<li><strong>SSL 인증서 발급 (Let&#8217;s Encrypt)</strong> <code>sudo certbot --nginx -d test.com -d www.test.com</code></li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50)"/>



<h2 class="wp-block-heading">5. 트러블슈팅</h2>



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



<h4 class="wp-block-heading">문제 1: WordPress 리다이렉트 루프</h4>



<p><strong>원인:</strong> WordPress가 HTTPS를 인식하지 못함<br><strong>해결:</strong> <code>wp-config.php</code>에 프록시 인식 코드 확인</p>



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



<h4 class="wp-block-heading">문제 2: Mixed Content 경고</h4>



<p><strong>원인:</strong> HTTP 리소스가 HTTPS 페이지에 로드됨<br><strong>해결:</strong> WordPress 설정 &gt; 사이트 주소를 <code>https://</code>로 변경</p>



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



<h4 class="wp-block-heading">문제 3: 502 Bad Gateway</h4>



<p><strong>원인:</strong> Apache가 5050 포트에서 실행되지 않음<br><strong>해결:</strong></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 systemctl status apache2
sudo netstat -tlnp | grep 5050
</pre>



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



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



<p><strong>원인:</strong> 인증서 경로가 올바르지 않음<br><strong>해결:</strong> Nginx 설정에서 인증서 경로 확인</p>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h2 class="wp-block-heading">6. 보안 체크리스트</h2>



<ul class="wp-block-list">
<li>[ ] HTTP → HTTPS 강제 리다이렉트 작동</li>



<li>[ ] Apache는 localhost(127.0.0.1)에서만 접근 가능</li>



<li>[ ] SSL 인증서 자동 갱신 설정</li>



<li>[ ] 보안 헤더(HSTS, X-Frame-Options 등) 적용</li>



<li>[ ] <code>.ht</code> 파일 접근 차단</li>



<li>[ ] 방화벽에서 5050 포트 외부 차단</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



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



<ol class="wp-block-list">
<li><strong>Nginx 캐싱 활성화</strong>: 정적 파일을 Nginx에서 직접 서빙</li>



<li><strong>Gzip 압축</strong>: 텍스트 기반 콘텐츠 압축</li>



<li><strong>HTTP/2 활성화</strong>: 이미 설정됨 (<code>http2</code> 옵션)</li>



<li><strong>Keep-Alive 설정</strong>: 연결 재사용</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h2 class="wp-block-heading">참고 사항</h2>



<ul class="wp-block-list">
<li><strong>도메인</strong>: 실제 도메인으로 <code>test.com</code> 변경 필요</li>



<li><strong>경로</strong>: WordPress 설치 경로에 맞게 수정</li>



<li><strong>포트</strong>: 5050 포트는 예시이며, 다른 포트 사용 가능 (보안을 위해 비표준 포트 권장)</li>



<li><strong>로그</strong>: 각 설정 파일에 명시된 로그 경로에서 문제 진단 가능</li>
</ul>



<p></p>
<p>The post <a href="https://lycos7560.com/ubuntu/nginx-apache-reverse-proxy/40373/">Nginx + Apache / Reverse Proxy</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/ubuntu/nginx-apache-reverse-proxy/40373/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress .htaccess 핫링크 방지, 리디렉션</title>
		<link>https://lycos7560.com/etc/wordpress-htaccess-%ed%95%ab%eb%a7%81%ed%81%ac-%eb%b0%a9%ec%a7%80-%eb%a6%ac%eb%94%94%eb%a0%89%ec%85%98/34021/</link>
					<comments>https://lycos7560.com/etc/wordpress-htaccess-%ed%95%ab%eb%a7%81%ed%81%ac-%eb%b0%a9%ec%a7%80-%eb%a6%ac%eb%94%94%eb%a0%89%ec%85%98/34021/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 14 Mar 2023 19:42:16 +0000</pubDate>
				<category><![CDATA[기타]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[hot-link prevention]]></category>
		<category><![CDATA[redirection]]></category>
		<category><![CDATA[RewriteEngine]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[리디렉션]]></category>
		<category><![CDATA[워드프레스]]></category>
		<category><![CDATA[이미지]]></category>
		<category><![CDATA[이미지 핫링크 방지]]></category>
		<category><![CDATA[핫링크 방지]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=34021</guid>

					<description><![CDATA[<p>워드프레스 .htacss 파일 작성에 대한 글입니다. 이미지 핫링크 방지 및 리디렉션에 대한 정보를 포함하고 있습니다. (This article is about creating a wordpress .htacss file. Contains information about image hot-link prevention and redirection.)</p>
<p>The post <a href="https://lycos7560.com/etc/wordpress-htaccess-%ed%95%ab%eb%a7%81%ed%81%ac-%eb%b0%a9%ec%a7%80-%eb%a6%ac%eb%94%94%eb%a0%89%ec%85%98/34021/">WordPress .htaccess 핫링크 방지, 리디렉션</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>



<h2 class="wp-block-heading">워드프레스 .htaccess</h2>



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



<pre class="EnlighterJSRAW" data-enlighter-language="htaccess" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?lycos7560.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?naver.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?nate.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?daum.net [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?paran.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.kr [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.co.kr [NC]
RewriteRule \.(pdf|PDF|zip|ZIP|gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG|7z|mp4|mp3)$ https://lycos7560.com/wp-content/uploads/2023/01/wtf.gif [NC,R,L]
&lt;/IfModule>

&lt;IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^p=([0-9]+)$
RewriteRule ^index\.php$ /%category%/%postname%/%post_id%/ [R=301,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
&lt;/IfModule>
</pre>



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



<h2 class="wp-block-heading">핫링크 방지</h2>



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



<pre class="EnlighterJSRAW" data-enlighter-language="htaccess" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;IfModule mod_rewrite.c>
# Apache가 mod_rewrite 모듈이 설치되고 활성화된 경우에만 다음 코드를 실행하도록 지시

RewriteEngine On
#특정 .htaccess 파일에 대해 mod_rewrite 엔진을 활성화


RewriteCond %{HTTP_REFERER} !^$
# HTTP_REFERER 변수가 비어 있지 않은지(즉, 요청에 참조 URL이 있는지) 확인하는 조건을 설정

# 참조 URL이 허용된 도메인 목록에 없는지 확인하는 조건을 설정
# 검색 엔진 허용
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?lycos7560.com [NC] // 내 도메인
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?naver.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?nate.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?daum.net [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?paran.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.kr [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.co.kr [NC]

# 특정 파일 유형에 대한 요청을 "wtf.gif" 이미지 파일로 리디렉션하지만 참조 URL이 허용된 도메인 목록에 없는 경우에만 해당됩니다. 
# 이는 핫링크를 방지하거나 차단되거나 승인되지 않은 요청에 대해 특정 이미지를 표시하는 데 사용될 수 있습니다.
RewriteRule \.(pdf|PDF|zip|ZIP|gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG|7z|mp4|mp3)$ https://lycos7560.com/wp-content/uploads/2023/01/wtf.gif [NC,R,L]

&lt;/IfModule>
</pre>



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



<h2 class="wp-block-heading">리디렉션</h2>



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



<pre class="EnlighterJSRAW" data-enlighter-language="htaccess" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;IfModule mod_rewrite.c>
# Apache가 mod_rewrite 모듈이 설치되고 활성화된 경우에만 다음 코드를 실행하도록 지시

RewriteEngine On
#특정 .htaccess 파일에 대해 mod_rewrite 엔진을 활성화

RewriteBase /
# 모든 후속 RewriteRules에 대한 기본 URL을 설정합니다. 
# 이 경우 기본 URL을 도메인의 루트로 설정합니다.


# 쿼리 문자열(예: "?" 문자 뒤의 URL 부분)이 "p=([0-9]+)" 패턴과 일치하는지 확인 
# 하나 이상의 숫자가 있는 쿼리 문자열 매개 변수 "p"와 일치합니다
RewriteCond %{QUERY_STRING} ^p=([0-9]+)$


# 이전 RewriteCond가 일치하면 이 RewriteRule은 요청을 새 URL로 리디렉션 
# 특히 이전 스타일의 WordPress 영구 링크(예: https://lycos7560.com/?p=1234)에 대한 요청을 
# 새로운 스타일의 영구 링크로 리디렉션
# [R=301,L]RewriteRule 끝에 있는 은 Apache에게 영구 리디렉션(301)을 실행하고 추가 규칙(L) 처리를 중지하도록 지시
RewriteRule ^index\.php$ /%category%/%postname%/%post_id%/ [R=301,L]


# HTTP_AUTHORITISION이라는 환경 변수를 만들고 HTTP 요청의 Authorization 헤더 내용에 값을 설정합니다.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


# index.php이 줄은 요청을 일치시키고 플래그 를 사용하여 추가 재작성 규칙 처리를 중지하는 재작성 규칙입니다 [L]. 
RewriteRule ^index\.php$ - [L]

# %{REQUEST_FILENAME}이 두 줄은 요청한 파일명( )이 파일( !-f)로 존재하지 않는지( ) 디렉토리로 존재하지 않는지( !-d) 를 확인하는 재작성 조건 
# 기존 파일이나 디렉토리에 대한 요청을 다시 쓰는 것을 방지
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# /index.php이 마지막 줄은 남아 있는 모든 요청을 일반적으로 웹 애플리케이션의 전면 컨트롤러인 로 리디렉션하는 재작성 규칙
# [L]은 추가 재작성 규칙 처리를 중지
RewriteRule . /index.php [L]

&lt;/IfModule></pre>



<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/etc/wordpress-htaccess-%ed%95%ab%eb%a7%81%ed%81%ac-%eb%b0%a9%ec%a7%80-%eb%a6%ac%eb%94%94%eb%a0%89%ec%85%98/34021/">WordPress .htaccess 핫링크 방지, 리디렉션</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/etc/wordpress-htaccess-%ed%95%ab%eb%a7%81%ed%81%ac-%eb%b0%a9%ec%a7%80-%eb%a6%ac%eb%94%94%eb%a0%89%ec%85%98/34021/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
