JAVA、PHP、前端、APP、网站开发 - 开发技术学习

开发技术学习 » 服务器 » apache多站点配置,windows环境多站点配置,linux+apache+php多站点配置

apache多站点配置,windows环境多站点配置,linux+apache+php多站点配置

这两天一直在弄网站的事,先是上一个月的vps挂了网上数据掉半个月的,接着重新买VPS,转移站点到二级域名blog.adophper.com上来. 于是乎在新的vps开始配置php环境:如果不知道如何如何配置php+apache+mysql环境请查看前面有一篇文章专门有配置步骤的; 首先我们先说linux: 编辑:vi /etc/httpd/conf/httpd.conf 在最后的几行可以看到有: NameVirtualHost *:80 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. # # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # 然后我们就接着这个的后面写我们的多站点配置: NameVirtualHost *:80 DocumentRoot D:/webroot/web001 ServerName www.web01.com DirectoryIndex index.html DocumentRoot D:/webroot/web002 ServerName www.web02.com DirectoryIndex index.html DocumentRoot D:/webroot/web003 ServerName www.web03.com DirectoryIndex index.html 重启APACHE后,就可以用上面的三个域名打开,就会显示不同的内容了,测试成功。 如果你开启了mod_rewrite重写的话还可以配置伪静态: 这里是你站点的伪静态规则 注意:这里面的大小写在linux系统的有区别的哦! 现在我们来说windows的多站点配置 找到httpd.conf 然后在文件中打到: # Virtual hosts # Include conf/extra/httpd-vhosts.conf 去掉Include 前面的#号来空格 在到文件夹extra中编辑http-vhosts.conf 这里面的配置就和上面的一样了!

站点声明:部分内容源自互联网,为传播信息之用,如有侵权,请联系我们删除。

© Copyright 2011-2024 www.kfju.com. All Rights Reserved.
超级字帖 版权所有。蜀ICP备12031064号