安装好apache后,默认访问apache下的htdocs下的文件
域名配置在apache 的httpd.conf中
要配置访问多个项目时就不太方便了
修改apache配置文件httpd.conf 开启vhosts
vim /etc/httpd/httpd.conf
查找 httpd-vhosts.conf 去掉之前的井号
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
然后在httpd-vhosts.conf中书写配置
<VirtualHost *:80>
ServerName localhost #内网访问
DocumentRoot "/usr/local/apache/htdocs/你的路径"
<Directory "/usr/local/apache/htdocs/你的路径">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
然后保存,重启服务器
访问该ip,完成!