Apache配置虚拟主机
2014-04-19 17:52
295 查看
1、修改Apache主配置文件
本文出自 “linux成长之路” 博客,请务必保留此出处http://linuxlovers.blog.51cto.com/6787002/1398656
[root@localhost ~]# vim /usr/local/apache2/conf/httpd.conf Include conf/extra/httpd-vhosts.conf2、修改虚拟主机文件
<VirtualHost *:80> # ServerAdmin webmaster@dummy-host.example.com [root@localhost two.com]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf DocumentRoot "/usr/local/apache2/htdocs/one.com" //网页文档配置路径 ServerName www.one.com //虚拟主机名称 ServerAlias www.1.com //虚拟主机别名 </VirtualHost> <VirtualHost *:80> DocumentRoot "/usr/local/apache2/htdocs/two.com" ServerName www.two.com ServerAlias www.1.com </VirtualHost>3、创建网页配置文件
[root@localhost htdocs]# mkdir one.com two.com [root@localhost htdocs]# cd one.com [root@localhost one.com]# echo "This is first page" >index.html [root@localhost htdocs]# cd two.com/ [root@localhost two.com]# echo "This is second page" >index.html4、测试
[root@localhost two.com]# /usr/local/apache2/bin/apachectl restart [root@localhost two.com]# curl www.one.com This is first page [root@localhost two.com]# curl www.two.com This is second page
本文出自 “linux成长之路” 博客,请务必保留此出处http://linuxlovers.blog.51cto.com/6787002/1398656
相关文章推荐
- Apache之——配置虚拟主机
- apache配置虚拟主机
- 配置虚拟主机(apache)之后,localhost(127.0.0.1)服务打不开方案
- apache配置虚拟主机(virtual host) 笔记
- window+Apache 配置虚拟主机
- apache设置反向代理访问 NodeJs 网站(wdcp 安装代理模块+配置虚拟主机)
- Apache配置虚拟主机
- Apache 配置虚拟主机
- window+Apache 配置虚拟主机(2)
- windows下配置虚拟主机wamp php+apache
- apache-配置虚拟主机
- window+Apache 配置虚拟主机(2)
- 配置虚拟主机并更改Apache默认解析路径
- apache2.4.27配置虚拟主机
- apache 配置多个网站(配置虚拟主机)
- Apache配置虚拟主机(2)
- Linux下Apache配置虚拟主机
- apache 配置虚拟主机
- apache配置虚拟主机
- 整合apache和JBoss,配置虚拟主机 推荐