[root@localhost ~]# vim /etc/httpd/conf/httpd.conf # If your host doesn't have a registered DNS name, enter its IP address here.
ServerName 0.0.0.0:80 //修改主配置文件
······
[root@localhost ~]# vim /usr/share/doc/httpd/httpd-vhosts.conf //打开虚拟主机的示例文件[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf //在con.f下创建虚拟主机配置文件,并将示例文件粘贴进去,再进行进一步的修改<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/var/www/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/var/log/httpd/dummy-host.example.com-error_log" //错误日志
CustomLog "/var/log/httpd/dummy-host.example.com-access_log" common //访问日志
</VirtualHost>