博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何在Apache Linux Web服务器上托管多个网站?
阅读量:2519 次
发布时间:2019-05-11

本文共 1465 字,大约阅读时间需要 4 分钟。

I have a web server with Apache (). How to host multiple websites on Apache?

我有一个带有Apache( )的 Web服务器。 如何在Apache上托管多个网站?

To host websites www.example1.com and www.example2.com on a single node with Apache2 on a single IP, you can use VirtualHost as follows.

要将网站www.example1.com和www.example2.com托管在单个节点上,而Apache2托管在单个IP上,则可以按以下方式使用VirtualHost。

Edit /etc/httpd/conf/httpd.conf and add the following lines:

编辑/etc/httpd/conf/httpd.conf并添加以下行:

NameVirtualHost *:80
DocumentRoot /var/www/example1.comServerName www.example1.com# Other directives here
DocumentRoot /var/www/example2.comServerName www.example2.com# Other directives here

Then you can store your websites under the corresponding directory specified with DocumentRoot for each domain.

然后,您可以将网站存储在每个域的DocumentRoot指定的相应目录下。

After restarting Apache2 by # apachectl restart or # systemctl restart httpd.service or # service httpd restart or other distro specific commands, each domain ( to the web server) will be in each own’s directory.

通过# systemctl restart httpd.service # apachectl restart# systemctl restart httpd.service# systemctl restart httpd.service # service httpd restart或其他发行版特定命令来重启Apache2之后,每个域( Web服务器)将位于各自的目录中。

Note that www.example1.com and example1.com are two different domains and you will need to set up two virtual hosts if you want to use both.

请注意,www.example1.com和example1.com是两个不同的域,如果要同时使用两个,则需要设置两个虚拟主机。

Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自:

转载地址:http://dplwd.baihongyu.com/

你可能感兴趣的文章
jquery的each()详细介绍
查看>>
Ext.data-GroupingStore/JsonStore/SimpleStore
查看>>
ExtJS之Store
查看>>
Ext Designer Preview生成代码在html上显示步骤
查看>>
Ext Designer
查看>>
『ExtJS』表单(二)表单行为与Asp.NET页面的消息回复
查看>>
『ExtJS』表单(一)常用表单控件及内置验证
查看>>
Extjs中三种不同的数据提交方式
查看>>
ExtJs2.0学习系列(1)--Ext.MessageBox
查看>>
ExtJs2.0学习系列(2)--Ext.Panel
查看>>
ExtJs2.0学习系列(3)--Ext.Window
查看>>
ExtJs2.0学习系列(4)--Ext.FormPanel之第一式
查看>>
ExtJs2.0学习系列(5)--Ext.FormPanel之第二式
查看>>
ExtJs2.0学习系列(6)--Ext.FormPanel之第三式(ComboBox篇)
查看>>
ExtJs2.0学习系列(7)--Ext.FormPanel之第四式(其他组件示例篇)
查看>>
ExtJs2.0学习系列(8)--Ext.FormPanel之第五式(综合篇)
查看>>
ExtJs2.0学习系列(9)--Ext.TabPanel之第一式
查看>>
ExtJs2.0学习系列(10)--Ext.TabPanel之第二式
查看>>
ExtJs2.0学习系列(11)--Ext.XTemplate
查看>>
ExtJs2.0学习系列(12)--Ext.TreePanel之第一式
查看>>