Apache 2.4 및 VirtualHosts 관련 문제

Apache 2.4 및 VirtualHosts 관련 문제

누군가 내가 여기서 뭘 잘못하고 있는지 말해 줄 수 있습니까? 3개의 VirtualHost가 포함된 Apache 2.4를 실행하는 1개의 서버가 있습니다. 다음과 같이 설정하십시오.

<VirtualHost helpedsk.example.com:80>
ServerAdmin [email protected]
DocumentRoot "${SRVROOT}/htdocs/hesk"
ServerName helpdesk.example.com
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
    <Directory "${SRVROOT}/htdocs/hesk">
        Require all granted
        Options Indexes FollowSymLinks ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost wiki.example.com:80>
    ServerAdmin [email protected]
    DocumentRoot "${SRVROOT}/htdocs/dokuwiki"
    ServerName wiki.example.com
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
    <Directory "${SRVROOT}/htdocs/dokuwiki">
        Require all granted
        Options Indexes FollowSymLinks ExecCGI
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

<VirtualHost docs.example.com:80>
    ServerAdmin [email protected]
    DocumentRoot "${SRVROOT}/htdocs/drupal"
    ServerName docs.example.com
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
    <Directory "${SRVROOT}/htdocs/drupal">
        Require all granted
        Options Indexes FollowSymLinks ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

그러나 어떤 이유에서인지 마지막 것만 작동합니다. 첫 번째는 서버의 문서 루트(hesk 없이)를 보여주고 두 번째는 자체적으로 무제한 리디렉션에 들어가는데 이유를 알 수 없습니다. 두 번째는 아마도 나중에 변경할 수 있는 서버 ip/dokuwiki를 가리키도록 설정했기 때문에 해야 합니다. 그런데 첫 번째 항목은 왜 hesk하지 않습니까?

이러한 모든 사이트는 serverip/site를 사용하여 액세스할 때 제대로 작동하지만 이름으로 액세스하려고 하면 마지막 사이트만 작동합니다.

답변1

신경 쓰지 마세요. *:80에 대한 모든 VirtualHost 줄을 변경하고 ServerName을 사이트 URL과 함께 남겨두었고 현재 작동 중입니다.

관련 정보