我有很多站点需要配置,每个域都针对一个特定的部门,所以我的虚拟主机段实际上是相同的,我已经使用 include 指令进行了优化,但我认为还有其他东西需要压缩。
<VirtualHost *:80>
ServerName www.domain-department-1.com
DocumentRoot /var/www/html/domain-department-1.com
<Directory "/var/www/html/domain-department-1.com">
Include conf.d/folder-config.conf
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain-department-2.com
DocumentRoot /var/www/html/domain-department-2.com
<Directory "/var/www/html/domain-department-2.com">
Include conf.d/folder-config.conf
</Directory>
</VirtualHost>
答案1
使用 mod_vhost_alias,它有大量的文档记录 https://httpd.apache.org/docs/current/vhosts/mass.html