Centos Apache 多站点配置


 首先明白APACHE配置文件位置

/etc/httpd/

系统会自动加载 "/etc/httpd/conf.d" 目录下面的 "*.conf"文件

创建多个 ".conf" 文件来配置多站点,类似如下

<VirtualHost *:80>
    ServerAdmin email@163.com
# 网站根目录 DocumentRoot /opt/www/double-xu/trunk
# 网站域名 ServerName xxx.com
# 默认首页
DirectoryIndex index.html index.php
# 错误日志(注意logs文件夹必须存在,否则启动apache会失败) ErrorLog /opt/logs/error.log
# 访问日志 CustomLog /opt/logs/customer common </VirtualHost>

注意一点:多个 “.conf” 文件中,前面要加上一行 “NameVirtualHost *:80”,而且不能每一个都加,只能有一个有这一行

也可以直接注释掉 “/etc/httpd/conf/httpd.conf” 这个文件中的 “NameVirtualHost *:80”即可


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM