tomcat 与 域名映射

一  准备工作:

  1. 阿里云服务器Linux镜像 及 域名备案和将域名解析至服务器,通过<暂不说,网上一大把或者参考阿里官方实例手册>
  2. 在Linux镜像中安装tomcat+jdk环境,并将web项目打包上传至tomcat的webapps路径下
  3. 服务器开放80端口,及linux 镜像将80规则写入防火墙中

二:tomcat 映射域名 打开 tomcat的server.xml文件

  • 1 将8080端口设置为80端口,直接映射80端口,为了省略项目访问时候输入端口号:8080  
  • 2设置域名及映射的项目名称,加入<context> 节点
  • 注:这里是将项目方在webapps下  这段设置为 将域名:www.shangluo.store映射至 webapps/HelloWorld项目

  • <context >节点为自己加

  •  <Context docBase="HelloWorld" path=""  reloadable="true" > </Context>
    
  • 保存退出 访问:你好世界!!

  

tomcat 配置:主要两点

  1.8080 ---> 80

  2.

<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="" minSpareThreads=""/>
--> <!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port
-->
<Connector port="" protocol="HTTP/1.1"
connectionTimeout=""
redirectPort="" URIEncoding="UTF-8" /> <!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="" protocol="HTTP/1.1"
connectionTimeout=""
redirectPort="" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
--> <!-- Define an AJP 1.3 Connector on port -->
<Connector port="" protocol="AJP/1.3" redirectPort="" /> <!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
--> <!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm> <Host name="www.shangluo.store" appBase="webapps"
unpackWARs="true" autoDeploy="true" > <Context docBase="HelloWorld" path="" reloadable="true" > </Context>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
--> <!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host>
</Engine>
</Service>
</Server>

最新文章

  1. python学习之字典
  2. Java中常用的运算符
  3. MySQL 命令行导出、导入Select 查询结果
  4. Upgrade Bioconductor
  5. 《Java中方法的参数传递方式只有一种:值传递》
  6. Qt QTreeWidget 树形结构实现(转)
  7. Entity Framework映射的总结
  8. 线程中sleep方法和wait方法有什么区别?
  9. Python中字符串拼接的三种方式
  10. Linux 进程与信号的概念和操作
  11. Shopping List
  12. H5_canvas与svg
  13. python里文件读写操作
  14. i春秋SRC部落携手同程SRC发布首届漏洞提交任务
  15. MVC中如何避免POST请求中出现的重复提交
  16. Java虚拟机的组成
  17. js高级-执行上下文
  18. python出现UnicodeEncodeError有可能产生的另一个原因
  19. Go net/http获取body中json格式数据
  20. python编程遇见的异常

热门文章

  1. 树莓派4B安装netcore
  2. opencv resize图片为正方形尺寸
  3. Redis报错: StackExchange.Redis.RedisServerException: Endpoint 39.105.22.111:7200 serving hashslot 12448 is not reachable at this point of time.
  4. 探索 IPv6 网络
  5. java struts2 debug
  6. WebGPU学习(二): 学习“绘制一个三角形”示例
  7. Chapter 02—Creating a dataset(Part3-补充材料Stat/Transfer)
  8. MATLAB工具包——curvelet变换的理解(转)
  9. 谷歌地图 API 开发之获取坐标以及街道详情
  10. 主机配置静态IP