Apache용 변수

Apache용 변수

저는 수백 개의 사이트를 호스팅하기 위해 Apache 웹 서버를 설정하는 중입니다. 사이트는 일부 사이트별 정보(서버 이름, 문서 루트, 디렉터리, 로그 경로)를 제외하고 구성이 거의 동일합니다.

나는 각 사이트의 conf 파일에 변수를 정의한 다음 사이트 설정이 포함된 파일을 포함하기를 바랐습니다.

예를 들어, 어떤 방식으로든 다음 변수를 정의한 다음 표준 구성에 대한 포함 파일을 호출하는 site1.conf라는 구성 파일을 갖고 싶습니다.

Define subdomain site1
Include /etc/httpd/sitedefaults.conf

그런 다음 sitedefaults.conf 내에서 site1.conf에 정의된 변수를 사용하는 다음과 같은 것을 만듭니다.

<VirtualHost 10.10.10.10:80>
  ServerName $subdomain.example.com
  DocumentRoot /var/www/$subdomain/

  ServerAdmin [email protected]

  ErrorLog /var/log/httpd/$subdomain/error.log
  CustomLog /var/log/httpd/$subdomain/access.log combined

  <Directory "/var/www/$subdomain/docs">
    Options FollowSymLinks Multiviews
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

이런 일이 가능합니까?

관련 정보