大网数据广告活动
网站运营与故障问答

Possible to split virtual host definitions into multiple apache conf files?

· 52CE 我爱测

I have a single server that I use to host a whole bunch of smallish websites. It's recently come to my attention that a service called LetsEncrypt allows me to get an SSL certificate for free. The catch, as far as I can tell, is …

问题原文

原帖链接 · Pecon · CC BY-SA 3.0

I have a single server that I use to host a whole bunch of smallish websites. It's recently come to my attention that a service called LetsEncrypt allows me to get an SSL certificate for free. The catch, as far as I can tell, is that they don't allow you to do any traditional SSL setup and instead you must use a script they provide which automatically requests a certificate for your server and configures apache for it. The problem, now, is that their setup script does not support the fact that I have 8+ virtual hosts all in my single 000-default.conf file for apache.

So my question is, how do I configure apache to read multiple site configuration files so that I can separate my different virtual host definitions into different files?

已采纳解答

原帖链接 · MrWhite · CC BY-SA 3.0

You can use the Include directive to include other config files and split up your main config.

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

You can also use wildcards, so you can have each virtual host in a separate config file and include all without having to modify your main config file:

Include conf/extra/vhosts/*.conf

Reference:
https://httpd.apache.org/docs/2.4/mod/core.html#include

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。