日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【记录】在云服务器安装tomcat部署自己的项目 通过ip无需加端口号直接访问

發(fā)布時間:2024/9/30 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【记录】在云服务器安装tomcat部署自己的项目 通过ip无需加端口号直接访问 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

直接記錄自己的server.xml代碼:
以下代碼配置后可以通過ip+8080訪問:

<Server port="-1" shutdown="SHUTDOWN"><Listener className="org.apache.catalina.startup.VersionLoggerListener" /><Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /><!-- 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" /><GlobalNamingResources><!-- Editable user database that can also be used byUserDatabaseRealm 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><Service name="Catalina"><Connector port="8080" protocol="HTTP/1.1"address="0.0.0.0" connectionTimeout="20000"redirectPort="8443"URIEncoding="UTF-8"/><Connector port="8080" protocol="AJP/1.3"address="0.0.0.0" redirectPort="8443" URIEncoding="UTF-8"/><Realm className="org.apache.catalina.realm.LockOutRealm"><!-- This Realm uses the UserDatabase configured in the global JNDIresources under the key "UserDatabase". Any editsthat are performed against this UserDatabase are immediatelyavailable for use by the Realm. --><Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase"/></Realm><Host name="121.5.227.176" appBase="webapps"unpackWARs="true" autoDeploy="true"> <Context path="" docBase="C:\Program Files (x86)\Apache Software Foundation\Tomcat 9.0\webapps\ROOT" reloadable="true" /><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>


設(shè)置直接通過ip訪問(不需要端口號)

我先是在網(wǎng)站綁定當中刪除80端口
然后

<Connector port="80" protocol="HTTP/1.1"address="0.0.0.0" connectionTimeout="20000"redirectPort="8443"URIEncoding="UTF-8"/><Connector port="80" protocol="AJP/1.3"address="0.0.0.0" redirectPort="8443" URIEncoding="UTF-8"/> <Engine name="Catalina" defaultHost="121.5.227.176"><!--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 passwordsvia a brute-force attack --><Realm className="org.apache.catalina.realm.LockOutRealm"><!-- This Realm uses the UserDatabase configured in the global JNDIresources under the key "UserDatabase". Any editsthat are performed against this UserDatabase are immediatelyavailable for use by the Realm. --><Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase"/></Realm><Host name="121.5.227.176" appBase="webapps"unpackWARs="true" autoDeploy="true"> <Context path="" docBase="C:\Program Files (x86)\Apache Software Foundation\Tomcat 9.0\webapps\ROOT" reloadable="true" /><!-- SingleSignOn valve, share authentication between web applicationsDocumentation at: /docs/config/valve.html --><!--<Valve className="org.apache.catalina.authenticator.SingleSignOn" />--><!-- Access log processes all example.Documentation at: /docs/config/valve.htmlNote: 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>

另外看了很多帖子好像都是在eclipse里面打開tomcat,我沒有用eclipse打開,直接是安裝了tomcat9,然后把static和index.html粘貼到webapps下面,然后那個</context 的配置我也不知道是咋回事,好像很多帖子是有項目名,但是我的貌似沒有項目名

總結(jié)

以上是生活随笔為你收集整理的【记录】在云服务器安装tomcat部署自己的项目 通过ip无需加端口号直接访问的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。