아파치몇 가지 옵션에 대한 태그

아파치몇 가지 옵션에 대한 태그

LocationApache 구성에 몇 개의 태그를 설정하고 싶습니다 . 예를 들어 /image, /file, /audio및 에 전달합니다 localhost:port/path. 지금은 다음 용도로 사용하고 있습니다 /image.

 <Location /image>
        RewriteEngine  on
        Options +MultiViews +FollowSymLinks
        AllowOverride All
        ProxyPreserveHost On
        ProxyPass "http://localhost:PORT/image"
        ProxyPassReverse "http://localhost:PORT/image"
    </Location>

모든 매개변수에 대해 이 코드를 작성해야 합니까? 아니면 단축키가 있나요?

감사해요!

답변1

<Location /image>
   RewriteEngine  on
   Options +MultiViews +FollowSymLinks
   AllowOverride All
   ProxyPreserveHost On
   ProxyPass "http://localhost:PORT/image"
   ProxyPassReverse "http://localhost:PORT/image"
</Location>

모든 매개변수에 대해 이 코드를 작성해야 합니까?

아니요. RewriteEngine지시문은 아무 작업도 수행하지 않으며 로컬 파일 시스템의 리소스에 매핑하지 않으면 지시문 Options도 의미가 없습니다. AllowOverride이러한 옵션은 지시어를 사용하여 요청을 전달하는 "원격" 웹 서버에 의해 제어되며 설정되어야 합니다 ProxyPass.

이러한 지시어는 쓸모가 없으므로 이를 설정하는 데 위치 괄호가 필요하지 않으며 인라인을 사용할 수 있습니다.ProxyPass어쨌든 권장되는 구문입니다.

그러면 구문이 필요한 줄로만 줄어듭니다.

ProxyPreserveHost On

ProxyPass "/image" "http://localhost:PORT/image"
ProxyPassReverse "/image" "http://localhost:PORT/image"

ProxyPass "/file" "http://localhost:PORT/file"
ProxyPassReverse "/file" "http://localhost:PORT/file"

Apache httpd는 다음을 제공합니다.Include동일한 행을 여러 번 복사하지 않고 다른 위치, VirtualHost, 위치, 디렉토리 블록에 축어적으로 포함하려는 설정으로 단일 구성 조각을 유지 관리하는 지시문입니다.

관련 정보