因为我在文件/etc/apche247/conf/extra/httdp-vhost.conf有很多虚拟/etc/apche247/conf/extra/httdp-vhost.conf ,所以这个文件是非常广泛而且没有组织的。
我知道一些创buildVirtualHostdynamic的方法,但是使用启用了站点的文件夹自动安装Apache(apt-get / yum / pacman install)。
但是,如果编译好的Apache这样的文件夹不存在,并且不知道dynamic的方式(不需要在httpd.conf中包含文件)就可以做到这一点。
这是我的Apache(2.4.7)文件夹:
root@ubuntu:/etc/apache247# ll total 76 drwxrwxrwx 15 root root 4096 Jan 19 12:16 ./ drwxr-xr-x 153 root root 12288 Jan 19 21:38 ../ drwxr-xr-x 2 root root 4096 Jan 19 12:16 bin/ drwxr-xr-x 2 root root 4096 Jan 19 12:16 build/ drwxr-xr-x 2 root root 4096 Jan 19 12:16 cgi-bin/ drwxr-xr-x 4 root root 4096 Jan 19 21:40 conf/ drwxr-xr-x 3 root root 4096 Jan 19 12:16 error/ drwxr-xr-x 2 root root 4096 Jan 19 11:38 htdocs/ drwxr-xr-x 3 root root 4096 Jan 19 12:16 icons/ drwxr-xr-x 2 root root 4096 Jan 19 12:16 include/ drwxr-xr-x 4 root root 4096 Jan 19 12:16 lib/ drwxr-xr-x 2 root root 4096 Jan 19 21:37 logs/ drwxr-xr-x 4 root root 4096 Jan 19 12:16 man/ drwxr-xr-x 14 root root 12288 Nov 19 15:36 manual/ drwxr-xr-x 2 root root 4096 Jan 19 21:30 modules/
在你的主configuration文件中使用Include 。
要sites-enabled类似Debian的sites-enabled :
Include /etc/apache247/sites-enabled/*
或者RHEL-like conf.d:
Include /etc/apache247/conf.d/*.conf
(根据需要为每个目录创build目录)