bmwm3 发表于 2018-11-21 12:58:15

apache2.4 虚拟主机配置

  注释掉主配置文件 /etc/httpd/httpd.conf 的中心主机行
  #DocumentRoot "/usr/local/httpd/htdocs"

  

  同时把找到 # Virtual hosts行,把下面行的注释去掉,载入虚拟主机配置文件。
  Include /etc/httpd/extra/httpd-vhosts.conf
  

  另外创建2个目录。

  mkdir /www/{a.com,b.com} -pv
  mkdir /var/log/httpd

  另外:主配置文件的 Require all granted 是允许所有访问的,但是还是需要在vhots.conf里填入Require all granted 才能正常访问。
  配置文件如下:
  

  
    ServerName www.b.com
    DocumentRoot "/www/b.com"
    ErrorLog "/var/log/httpd/b.com-error_log"
    CustomLog "/var/log/httpd/b.com-access_log" common
   
      Options none
      AllowOverride none
      Require all granted
   




页: [1]
查看完整版本: apache2.4 虚拟主机配置