发表于: 2018-04-09 23:01:01
1 595
今天完成的事情:
1.resin.xml文件,虚拟主机。(http://blog.51cto.com/huangsir007/1846225)
根据resin官方阐述,resin也能做web服务器,于是配置虚拟主机,看看效果
编辑配置文件vim resin.xml
<cluster id="app">
<server-multi id-prefix="app-" address-list="${app_servers}" port="6800"/>
<host-default>
<web-app-deploy path="webapps"
expand-preserve-fileset="WEB-INF/work/**"
multiversion-routing="${webapp_multiversion_routing}"
path-suffix="${elastic_webapp?resin.id:''}"/>
</host-default>
<host-deploy path="hosts">
<host-default>
<resin:import path="host.xml" optional="true"/>
</host-default>
</host-deploy>
<host id="" root-directory=".">
<web-app id="/" root-directory="webapps/ROOT"/>
</host>
<resin:if test="${resin_doc}">
<host id="${resin_doc_host}" root-directory="${resin_doc_host}">
<web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
</host>
</resin:if>
</cluster>
这里是摘出来的一段默认的cluster配置,这里大致介绍下配置参数的含义,更多详细内容参考官方文档
<cluster id="app"> cluster是标签,id是The cluster identifier.,cluster的标识符,下面的server标签中的id也是类似
<server-multi id-prefix="app-" address-list="${app_servers}" port="6800"/>
server-multi:相当于多个server组合,id-prefix:以某某为前缀的组合,这里是以app-
address-list="${app_servers}":指一个address列表,这里参考配置文件resin.properties中
app_servers : 127.0.0.1:6800这个参数,当然也可以不使用宏定义,而以下面的方式
<server-multi id-prefix="app-" address-list="192.168.1.2 192.168.1.3" port="6800"/>
port="6800":指监听的tcp端口
<host id="" root-directory=".">
<web-app id="/" root-directory="webapps/ROOT"/>
</host>
host id="" root-directory=".":这里的id指的是主机名域名,相当于是www.baidu.com,官方解释是primary host name
root-directory=".":Root directory for host files parent directory
这里的.指的是resin的家目录
当然host标签还有其他参数:
regexp Regular expression based host matching none
host-name Canonical host name none
host-alias Aliases matching the same host none
secure-host-name Host to use for a redirect to SSL none
<web-app id="/" root-directory="webapps/ROOT"/>:这里的id指的是The url prefix selecting this application.,也就是uri这里就是www.baidu.com/最后的/
root-directory="webapps/ROOT":The root directory for the application, corresponding to a url of /id/. A relative path is relative to the <root-directory> of the containing <host>. Can use regexp replacement variables.我理解为网站的根目录
因为ROOT下面就是index,jsp也就是www.baidu.com/index.jsp
明天的计划:
遇到的问题:
收获:
评论