简体   繁体   English

将Apache vhost配置(httpd-vhosts.conf或httpd.conf)放在哪里?

[英]Where to put Apache vhost configuration (httpd-vhosts.conf or httpd.conf)?

I just to ask a simple question. 我只想问一个简单的问题。 I am studying the vhost configuration but I am confused where should I properly put my vhosts configuration? 我正在研究虚拟主机配置,但是我很困惑应该在哪里正确放置虚拟主机配置?

I have a file that has a name httpd-vhosts.conf and httpd.conf I try to put my configuration in these 2 files but different web projects. 我有一个名为httpd-vhosts.confhttpd.conf的文件,我尝试将配置放入这2个文件中,但使用不同的Web项目。 And after I restarted my Wampserver I can access them. 重新启动Wampserver之后,我可以访问它们了。 Is it fine if I place all my vhost entries in the file httpd-vhosts.conf ? 如果我将所有虚拟主机条目都放在文件httpd-vhosts.conf吗? Or should I place it in httpd.conf 还是应该将其放在httpd.conf

There is no right or wrong. 没有对与错。 Apache has one global config file, which typically is the default or specified in the startup script. Apache有一个全局配置文件,该文件通常是默认值或在启动脚本中指定的文件。

This file then uses one or more secondary config files and directories. 然后,此文件使用一个或多个辅助配置文件和目录。 Different Linux distributions use different default include directories. 不同的Linux发行版使用不同的默认包含目录。

On CentOS I think for example you would put a file (named like your domain but can be anything) in /etc/httpd/conf.d/example-com.conf: http://wiki.centos.org/TipsAndTricks/ApacheVhostDir 例如,在CentOS上,我认为您可以在/etc/httpd/conf.d/example-com.conf中放置一个文件(名称类似于您的域,但可以是任何东西): http ://wiki.centos.org/TipsAndTricks/ApacheVhostDir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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