简体   繁体   中英

Apache2 - multiple sites, easiest setup

I'd like to use mod_vhost_alias for ease of site setup in Apache2.2. So I'd have my virtual host setup something like this:

<VirtualHost *:80>
    VirtualDocumentRoot "/var/www/%0"
</VirtualHost>

What I'd also like to do on a per site basis, is to include an extra config file - something like this:

<VirtualHost *:80>
    VirtualDocumentRoot "/var/www/%0"
    Include "/var/www/%0/http.conf"
</VirtualHost>

But Apache doesn't seem to like this. Is there any other way of achieving this?

Thanks,

James.

You can do this the other way around: include a directory in your main configuration file, and have one configuration file for each site in there. Eg

http.conf

Include /apache/sites/

/apache/sites/site1.conf

<VirtualHost *>
  host specific configuration here..
</VirtualHost *>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM