Apache를 하위 디렉터리로 사용하여 Wordpress 블로그 호스팅

Apache를 하위 디렉터리로 사용하여 Wordpress 블로그 호스팅

CloudFront 뒤의 S3에 기존 정적 웹 앱이 있습니다.example.com

다음 위치에서 액세스할 수 있는 WordPress 블로그를 추가하고 싶습니다.example.com/blog

WordPress 블로그의 경우 Apache와 WordPress를 사용하여 ec2 서버를 설정했습니다.

설명대로 CloudFront에 ec2 서버를 오리진으로 추가했습니다.여기.

내가 달릴 때:

curl example.com/blog

나는 얻고있다 :

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://ec2-x-x-x-x.us-west-1.compute.amazonaws.com/blog/">here</a>.</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at http://ec2-x-x-x-x.us-west-1.compute.amazonaws.com Port 80</address>
</body></html>

그렇기 때문에 내 문제는 CloudFront가 아니라 Apache 서버 구성에 있다고 생각합니다.

내 질문은: Apache가 이런 방식으로 작동하도록 구성하는 방법입니다.

하위 디렉토리로서의 의미

답변1

Apache가 브라우저에 301 Moved Permanently를 알릴 때 레벨 또는 전역 레벨에서 ServerName지정한 것을 사용합니다.<VirtualHost>

설정하지 않으면 ServerName경험적 방법(IP 주소 중 하나에 대한 역방향 DNS 쿼리)을 통해 FQDN을 찾으려고 시도하며 일반적으로 슬픈 결과를 얻게 됩니다.

예:

ServerName example.com
ServerName http://example.com
ServerName https://example.com:8443

관련 정보