apache2.4以上版本配置虚拟主机
一 将 主配置文件 httpd.conf中
#Include conf/extra/httpd-vhosts.conf 前面的# 去掉
二 进入conf/extra
修改 /conf/extra/httpd-vhosts.conf
增加下面内容 ,2.4以后这部分内容很重要
<Directory "/www/html/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
/www/html/是根目录
然后在下面增加:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/srv/http/yii2/web"
ServerName yii2
ErrorLog "/var/log/httpd/dummy-host2.example.com-error_log"
CustomLog "/var/log/httpd/dummy-host2.example.com-access_log" combined
</VirtualHost>
ServerName 以及DocumentRoot这一部分一定要写对!其它可以默认即可!
浙公网安备 33010602011771号