企业常见需求,如何让一个ip和多个域名(虚拟主机)绑定呢? 解决方案: 1,通过端口来区分不同的站点 先开发第一个网站 1,先开发好自己的网站 d:/myweb 2,配置我们的httpd.conf文件,启用httpd-vhosts.conf 3,配置httpd-vhosts.conf #配置我们自己的虚拟主机 <VirtualHost 127.0.0.1:80> DocumentRoot "d:/myweb" DirectoryIndex index.html index.htm index.php #/ 前有空格 <Directory /> options FollowSymlinks #不允许别人修改我们的页面 AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> 4,在hosts文件中添加ip和域名的对应关系(以后工作时,需要在万网) c:/windows/system32/drivers/etc/hosts 127.0.0.1 www.yuhua.com 5,测试 写的这么细,今天记得住,明天就忘了,步骤些的东西 再开发另一个网站 1,开发新的网站 d:/myweb2 2,配置httpd-vhosts.conf 添加新的虚拟主机 <VirtualHost 127.0.0.1:81> DocumentRoot "d:/myweb2" DirectoryIndex my.html index.html index.htm index.php #/ 前有空格 <Directory /> options FollowSymlinks #不允许别人修改我们的页面 AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> 3,在httpd.cof文件中添加 让apache监听81端口 Listen 81 4,在hosts文件添加新的域名 127.0.0.1 www.yuhua1.com 5,测试 http://www.yuhua1.com:81 2,通过ServerName段区分不同的域名 在httpd-vhosts.conf添加配置 (注意这时的配置和以前不一样) #配置我们自己的虚拟主机 <VirtualHost *:80> DocumentRoot "d:/myweb" ServerName www.yuhua.com DirectoryIndex abc.html index.html index.htm index.php <Directory /> options FollowSymlinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> #配置我们自己的虚拟主机 <VirtualHost *:80> DocumentRoot "d:/myweb2" ServerName www.yuhua1.com DirectoryIndex abc.html index.html index.htm index.php <Directory /> options FollowSymlinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> 3,测试, web站点含义: 提问:apache和数据库服务器在同一台机器上吗? apache和php在网络中的位置 使用uml图,描述请求php文件的整个流程
如何让一个ip和多个域名(虚拟主机)绑定[补充]
原创
©著作权归作者所有:来自51CTO博客作者Lerdorf的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:php开发环境的搭建
下一篇:php的基本语法和数据类型
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
apache配置多个域名访问同一个虚拟主机
[uronf里怎么配置一个域名都访syx...
apache 虚拟主机 .net