apache同一台机80端口部署多个站点
2016-04-12 14:26
686 查看
更多内容访问: 快智慧程序员社区
一台服务器安装了APACHE,如何绑定多个域名和网站内容呢?最简单的方法当然就是不同的站用不同的端口。但这样就需在域名后加入端口号才能访问,不能直接以域名访问。另一个方法就是使用主机头名虚所主机了。打开APACHE配置文件httpd.conf 在最后一行输入以下代码
Aapche 如果需要绑定多个域名到一个IP上,是支持的。需要注意以下2点:
1 必须要开启 NameVirtualHost开关选项,
如:NameVirtualHost 220.231.220.231:80
2 NameVirtualHost 需要指定具体的端口
例如”:80″,跟<VirtualHost 220.231.32.*:80>对应,否则会报错:
mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results。
翻译过来就是: NameVirtualHost 地址,指定端口和不指定端口混合使用是不支持的,将会产生未逾期的后果。
未逾期的后果就是: 第2个不起作用,仅当一个站点设置起作用。
完整的例子:
This entry was posted in Ububtu使用笔记.
Bookmark the permalink.
更多内容访问: 快智慧程序员社区
一台服务器安装了APACHE,如何绑定多个域名和网站内容呢?最简单的方法当然就是不同的站用不同的端口。但这样就需在域名后加入端口号才能访问,不能直接以域名访问。另一个方法就是使用主机头名虚所主机了。打开APACHE配置文件httpd.conf 在最后一行输入以下代码
Aapche 如果需要绑定多个域名到一个IP上,是支持的。需要注意以下2点:
1 必须要开启 NameVirtualHost开关选项,
如:NameVirtualHost 220.231.220.231:80
2 NameVi
ab1c
rtualHost 需要指定具体的端口
例如”:80″,跟<VirtualHost 220.231.32.*:80>对应,否则会报错:
mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results。
翻译过来就是: NameVirtualHost 地址,指定端口和不指定端口混合使用是不支持的,将会产生未逾期的后果。
未逾期的后果就是: 第2个不起作用,仅当一个站点设置起作用。
完整的例子:
This entry was posted in Ububtu使用笔记.
Bookmark the permalink.
一台服务器安装了APACHE,如何绑定多个域名和网站内容呢?最简单的方法当然就是不同的站用不同的端口。但这样就需在域名后加入端口号才能访问,不能直接以域名访问。另一个方法就是使用主机头名虚所主机了。打开APACHE配置文件httpd.conf 在最后一行输入以下代码
<VirtualHost *:80> #第一个主机,80端口 DocumentRoot “D:/root/abc” #指向本地位置 ServerName www.abc.com #主机名称(注意这个很重要,就是你的域名,准确输入才能成功) </VirtualHost> #结束第一个主机配置 <VirtualHost *:80> #第二个主机,80端口 DocumentRoot “D:/root/def” #指向本地位置 ServerName www.def.com #主机名称 </VirtualHost> <VirtualHost *:80> #第三个主机,80端口 DocumentRoot “D:/root/ghi” #指向本地位置 ServerName www.ghi.com #主机名称 </VirtualHost>
Aapche 如果需要绑定多个域名到一个IP上,是支持的。需要注意以下2点:
1 必须要开启 NameVirtualHost开关选项,
如:NameVirtualHost 220.231.220.231:80
2 NameVirtualHost 需要指定具体的端口
例如”:80″,跟<VirtualHost 220.231.32.*:80>对应,否则会报错:
mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results。
翻译过来就是: NameVirtualHost 地址,指定端口和不指定端口混合使用是不支持的,将会产生未逾期的后果。
未逾期的后果就是: 第2个不起作用,仅当一个站点设置起作用。
完整的例子:
# # 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 219.133.61.226:80 <VirtualHost 219.133.61.226:80> ServerAdmin hot@vip.qq.com DocumentRoot /usr/local/apache2/htdocs1 ServerName www.linux51.com ErrorLog logs/linux51.com-error_log CustomLog logs/linux51.com-access_log common </VirtualHost> <VirtualHost 219.133.61.226:80> ServerAdmin hot@vip.qq.com DocumentRoot /usr/local/apache2/htdocs2 ServerName www.linux52.com ErrorLog logs/linux52.com-error_log CustomLog logs/linux52.com-access_log common </VirtualHost>
This entry was posted in Ububtu使用笔记.
Bookmark the permalink.
更多内容访问: 快智慧程序员社区
一台服务器安装了APACHE,如何绑定多个域名和网站内容呢?最简单的方法当然就是不同的站用不同的端口。但这样就需在域名后加入端口号才能访问,不能直接以域名访问。另一个方法就是使用主机头名虚所主机了。打开APACHE配置文件httpd.conf 在最后一行输入以下代码
<VirtualHost *:80> #第一个主机,80端口 DocumentRoot “D:/root/abc” #指向本地位置 ServerName www.abc.com #主机名称(注意这个很重要,就是你的域名,准确输入才能成功) </VirtualHost> #结束第一个主机配置 <VirtualHost *:80> #第二个主机,80端口 DocumentRoot “D:/root/def” #指向本地位置 ServerName www.def.com #主机名称 </VirtualHost> <VirtualHost *:80> #第三个主机,80端口 DocumentRoot “D:/root/ghi” #指向本地位置 ServerName www.ghi.com #主机名称 </VirtualHost>
Aapche 如果需要绑定多个域名到一个IP上,是支持的。需要注意以下2点:
1 必须要开启 NameVirtualHost开关选项,
如:NameVirtualHost 220.231.220.231:80
2 NameVi
ab1c
rtualHost 需要指定具体的端口
例如”:80″,跟<VirtualHost 220.231.32.*:80>对应,否则会报错:
mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results。
翻译过来就是: NameVirtualHost 地址,指定端口和不指定端口混合使用是不支持的,将会产生未逾期的后果。
未逾期的后果就是: 第2个不起作用,仅当一个站点设置起作用。
完整的例子:
# # 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 219.133.61.226:80 <VirtualHost 219.133.61.226:80> ServerAdmin hot@vip.qq.com DocumentRoot /usr/local/apache2/htdocs1 ServerName www.linux51.com ErrorLog logs/linux51.com-error_log CustomLog logs/linux51.com-access_log common </VirtualHost> <VirtualHost 219.133.61.226:80> ServerAdmin hot@vip.qq.com DocumentRoot /usr/local/apache2/htdocs2 ServerName www.linux52.com ErrorLog logs/linux52.com-error_log CustomLog logs/linux52.com-access_log common </VirtualHost>
This entry was posted in Ububtu使用笔记.
Bookmark the permalink.
相关文章推荐
- Apache Thrift 在Windows下的安装与开发
- apache安装
- Apache下PHP的几种工作方式
- Apache2.4.16+SVN1.7.9+svnmanager1.10 升级 (二)
- Windows下Apache以FastCGI模式运行PHP
- ANDROID : java.lang.NoSuchMethodError: 在 org.apache.commons.codec.binary.Base64
- 在Mac下配置php开发环境:Apache+php+MySql
- ab(Apache压力测试)
- Apache虚拟主机配置
- 非集成环境的php运行环境(Apache配置、Mysql)搭建安装图文教程
- tried to access method org.apache.poi.util.POILogg
- Apache CXF实现的RESTful形式的webservices
- Windows下的PHP开发环境搭建——PHP线程安全与非线程安全、Apache版本选择
- Apache Curator简单使用(一)
- apache 各种配置
- expected org.apache.hadoop.io.IntWritable, recieved org.apache.hadoop.io.Text
- 在Debian上配置Apache+MySQL+PHP4
- Apache Thrift - 可伸缩的跨语言服务开发框架
- Apache apr中内存分配子的current_free_index成员作用 转转转
- Apache Spark学习(二)