由于比较菜,踩过无数坑!
系统环境: Apache 2.4.6 + PHP + MySQL
设置文件夹位置 : etc/apache2/
找到 apache2.conf这个文件打开,找到Include 看 后边跟得是哪个文件,我的是ports.conf
然后 在当前目录下找到 ports.conf 添加 IncludeOptional sites-enabled/*.conf
上面那句 我猜是监听 sites-enabled文件夹下的所有以.conf结尾的文件。所以
到当前目录找 sites-enabled 然后添加 .conf结尾的文件就可以了。
.conf 配置文件 内容:文件命名随意
//这是一个文件 内配置的一个站点,如果要配置多个 建立多个.conf文件即可
<VirtualHost *:80>
ServerAdmin xxxxx@126.com //邮箱
ServerName xxxx.com //域名
ServerAlias *.xxxx.com //域名
DocumentRoot /home/zhubaoxin/dushi115/public_html/ //域名访问的文件内的路径(这个路径下放置网站内容的,路径可随意设置)
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>