首先明白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”即可

相关文章:

  • 2021-07-09
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2021-09-23
  • 2021-07-04
  • 2021-07-14
相关资源
相似解决方案