Apache에 의해 기록되거나 기록되지 않은 내용을 어떤 파일에서 수정할 수 있습니까?

Apache에 의해 기록되거나 기록되지 않은 내용을 어떤 파일에서 수정할 수 있습니까?

Apache가 설치된 Debian 8이 있습니다. 내 /etc/apache2/sites-available/000-default.conf것은 다음과 같습니다.
어떤 구성 파일에서 어떻게 Apache에 요청할 수 있나요?/var/log/apache2/other_vhosts_access.log다음에서 오는 트래픽 에 로그인하지 않으려면http://www.mysite2.org또는에서http://www.mysite3.org/subdir/?나머지 모든 내용은 평소와 같이 동일한 파일에 기록되어야 합니다 other_vhosts_access.log.

<VirtualHost *:80>
  ServerName www.mysite1.org
  DocumentRoot /home/www/mysite1
  <Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerName www.mysite2.org
  DocumentRoot /home/www/mysite2
  <Directory />
  ...
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerName www.mysite3.org
  DocumentRoot /home/www/mysite3
  <Directory />
  ...
  </Directory>
</VirtualHost>

+ 10 other virtual hosts

답변1

각 가상 호스트에는 오류 로그 및 공통 로그 정의가 필요합니다. 이러한 정의가 없으면 기본 로그가 사용됩니다. 또한 도메인 중 하나에 대한 것이 아닌 모든 트래픽(웹 사이트에서 DNS를 가리키는 사람들)을 포착하는 기본 가상 호스트를 만드는 것이 좋습니다. ). 이는 속이는 콘텐츠이므로 나쁜 결과를 초래할 수 있습니다.

그래서, 각 가상 호스트에서;

    ErrorLog "logs/web1-error_log"
    CustomLog "logs/web1-access_log" common

    ErrorLog "logs/web2-error_log"
    CustomLog "logs/web2-access_log" common

업데이트:

특정 디렉터리를 기록하지 않는 부분을 보지 못했습니다. 이는 환경 변수를 설정하여 달성할 수 있습니다.

답변2

답변을 주신 @MikeJonesey에게 감사드립니다. 더 자세한 내용을 추가하려면 다음을 입력하세요 /etc/apache2/sites-available/000-default.conf.

<VirtualHost *:80>
  ServerName www.mysite3.org
  DocumentRoot /home/www/mysite3
  <Directory />
  ...
  </Directory>
  SetEnvIf Request_URI "^/subdir(.*)$" dontlog
  CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined env=!dontlog
</VirtualHost>

관련 정보