简体   繁体   中英

Apache - two vhost conf files for same ServerName?

I have a PHP web app served by Apache on a vhost.

I've just created an API in Scala, and would like to deploy Apache vhost config for it without touching the vhost config of the PHP web app.

The PHP app is at www.mydomain.com and the API will be served at www.mydomain.com/api (same domain/subdomain, allowing cookies to be shared)

I'm trying to treat the Apache config for each as separate concerns, although they both share the same ServerName .

Is it possible to get Apache to accept two .conf files that, combined, form the definition of a vhost for a domain?

You are looking for the Include directive which allows to include other files to achieve what you want.

One line like the next in your vhost blocks should work.

Include /etc/httpd/common_setings.conf

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