{"id":98318,"date":"2024-06-18T18:26:03","date_gmt":"2024-06-18T10:26:03","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=98318"},"modified":"2024-06-18T18:26:03","modified_gmt":"2024-06-18T10:26:03","slug":"tomcat-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/tomcat-linux.html","title":{"rendered":"\u5927\u795e\u6559\u4f60\u8f7b\u677e\u9a7e\u9a6dTomcat"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nTomcat \u670d\u52a1\u5668\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u653e\u6e90\u4ee3\u7801\u7684Web \u5e94\u7528\u670d\u52a1\u5668\uff0c\u5c5e\u4e8e\u8f7b\u91cf\u7ea7\u5e94\u7528\u670d\u52a1\u5668\uff0c\u5728\u4e2d\u5c0f\u578b\u7cfb\u7edf\u548c\u5e76\u53d1\u8bbf\u95ee\u7528\u6237\u4e0d\u662f\u5f88\u591a\u7684\u573a\u5408\u4e0b\u88ab\u666e\u904d\u4f7f\u7528\uff0c\u662f\u5f00\u53d1\u548c\u8c03\u8bd5JSP \u7a0b\u5e8f\u7684\u9996\u9009\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"
\n\u5bf9\u4e8e\u4e00\u4e2a\u521d\u5b66\u8005\u6765\u8bf4\uff0c\u53ef\u4ee5\u8fd9\u6837\u8ba4\u4e3a\uff0c\u5f53\u5728\u4e00\u53f0\u673a\u5668\u4e0a\u914d\u7f6e\u597dApache \u670d\u52a1\u5668\uff0c\u53ef\u5229\u7528\u5b83\u54cd\u5e94HTML\uff08\u6807\u51c6\u901a\u7528\u6807\u8bb0\u8bed\u8a00\u4e0b\u7684\u4e00\u4e2a\u5e94\u7528\uff09\u9875\u9762\u7684\u8bbf\u95ee\u8bf7\u6c42\u3002\u5b9e\u9645\u4e0aTomcat\u662fApache \u670d\u52a1\u5668\u7684\u6269\u5c55\uff0c\u4f46\u8fd0\u884c\u65f6\u5b83\u662f\u72ec\u7acb\u8fd0\u884c\u7684\uff0c\u6240\u4ee5\u5f53\u4f60\u8fd0\u884ctomcat \u65f6\uff0c\u5b83\u5b9e\u9645\u4e0a\u4f5c\u4e3a\u4e00\u4e2a\u4e0eApache \u72ec\u7acb\u7684\u8fdb\u7a0b\u5355\u72ec\u8fd0\u884c\u7684\u3002
\n\u8bc0\u7a8d\u662f\uff0c\u5f53\u914d\u7f6e\u6b63\u786e\u65f6\uff0cApache \u4e3aHTML\u9875\u9762\u670d\u52a1\uff0c\u800cTomcat \u5b9e\u9645\u4e0a\u8fd0\u884cJSP \u9875\u9762\u548cServlet\u3002\u53e6\u5916\uff0cTomcat\u548cIIS\u7b49Web\u670d\u52a1\u5668\u4e00\u6837\uff0c\u5177\u6709\u5904\u7406HTML\u9875\u9762\u7684\u529f\u80fd\uff0c\u53e6\u5916\u5b83\u8fd8\u662f\u4e00\u4e2aServlet\u548cJSP\u5bb9\u5668\uff0c\u72ec\u7acb\u7684Servlet\u5bb9\u5668\u662fTomcat\u7684\u9ed8\u8ba4\u6a21\u5f0f\u3002\u4e0d\u8fc7\uff0cTomcat\u5904\u7406\u9759\u6001HTML\u7684\u80fd\u529b\u4e0d\u5982Apache\u670d\u52a1\u5668\u3002\u76ee\u524dTomcat\u6700\u65b0\u7248\u672c\u4e3a9.0\u3002<\/p>\n

\u4e00\u3001Tomcat\u4f53\u7cfb\u67b6\u6784<\/strong><\/div>\n

\"\"<\/p>\n

\u6838\u5fc3\u7ec4\u4ef6
\n<\/strong><\/span><\/div>\n
server\uff1a\u76f8\u5f53\u4e8e\u4e00\u4e2atomcat\u5b9e\u4f8b\u3002\u63a5\u6536\u5e76\u89e3\u6790\u8bf7\u6c42\u4fe1\u606f\uff1b\u5b8c\u6210\u76f8\u5173\u52a8\u4f5c\u540e\u628a\u54cd\u5e94\u7ed3\u679c\u8fd4\u56de\u7ed9\u8ba1\u7b97\u673a\u3002\r\nservice\uff1a\u6bcf\u4e2aserver\u5305\u542b\u591a\u4e2aservice\uff0c\u76f8\u4e92\u72ec\u7acb\uff0c\u4ec5\u5171\u4eabJVM\u4ee5\u53ca\u7c7b\u5e93\u3002\u7528\u4e8e\u628a\u8fde\u63a5\u5668(connector)\u4e0e\u5f15\u64ce(engine)\u5173\u8fde\u8d77\u6765,\u4e14\u4e00\u4e2aservice\u53ea\u80fd\u6709\u4e00\u4e2aengine\uff0c\u4f46\u662f\u53ef\u4ee5\u6709\u591a\u4e2aconnector\u3002\u56e0\u4e3aengine\u65e0\u6cd5\u76f4\u63a5\u63a5\u53d7\u8fde\u63a5\u5668\u53d1\u6765\u7684\u6570\u636e\u3002\r\nconnector\uff1a\u8d1f\u8d23\u5f00\u542fsocket\u5e76\u76d1\u542c\u5ba2\u6237\u7aef\u8bf7\u6c42\u3001\u8fd4\u56de\u54cd\u5e94\u6570\u636e\u3002\u591a\u4e2aconnector\u76d1\u542c\u591a\u4e2a\u7aef\u53e3\r\nengine\uff1a\u8d1f\u8d23\u5177\u4f53\u7684\u5904\u7406\u8bf7\u6c42\uff0cconnector\u4ec5\u4ec5\u8d1f\u8d23\u76d1\u542c\uff0c\u6536\u5230\u6570\u636e\u540e\u4ea4\u7ed9engine\u8fd0\u884c\u3002\r\nhost\uff1a\u5728ngine\u4e2d\u53ef\u4ee5\u5305\u542b\u591a\u4e2ahost\uff0c\u6bcf\u4e2ahost\u5b9a\u4e49\u4e86\u865a\u62df\u4e3b\u673a\r\ncontext\uff1a\u6bcf\u4e2acontext\u53ef\u4ee5\u90e8\u7f72\u4e00\u4e2aweb\u5e94\u7528\u3002\u4e00\u4e2ahost\u53ef\u4ee5\u5b58\u5728\u591a\u4e2acontext\u3002\u5982\u679c\u90e8\u7f72\u591a\u4e2a\u5e94\u7528\u9700\u8981\u5206\u522b\u5bf9\u6bcf\u4e2a\u5e94\u7528\u88c5\u8f7d\u6240\u4f9d\u8d56\u7684\u5e93\uff0c\u8fd9\u4e2a\u6b65\u9aa4\u53ef\u4ee5\u81ea\u52a8\u53ef\u4ee5\u624b\u52a8\u3002<\/pre>\n
\u4e8c\u3001Tomcat\u7684\u5b89\u88c5<\/strong><\/div>\n

tomcat\u5176\u5b9e\u5c31\u662f\u4e00\u4e2aJAVA\u7a0b\u5e8f\uff0c\u6240\u4ee5\u8981\u8fd0\u884c\u5728JAVA\u865a\u62df\u673a\u4e2d\u3002\u8981\u8fd0\u884c\u865a\u62df\u673a\u5c31\u8981\u5148\u5b89\u88c5JDK\u3002<\/p>\n

1.JDK\u7684\u5b89\u88c5<\/strong><\/span><\/div>\n

1.\u901a\u8fc7YUM\u5b89\u88c5<\/p>\n

yum install java-1.8.0-openjdk-devel<\/pre>\n

2.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n

vim \/etc\/profile.d\/java.sh\r\n export JAVA_HOME=\/usr\/java\/latest                  # \u9996\u5148\u5b9a\u4e49JAVA_HOME\u7684\u73af\u5883\u53d8\u91cf\r\n export PATH=$JAVA_HOME\/bin:$PATH                   # \u7136\u540e\u5411\u540e\u8ffd\u52a0\u5373\u53ef<\/pre>\n
2.Tomcat\u7684\u5b89\u88c5<\/strong><\/span><\/div>\n

\u9996\u5148\u8981\u4eceTomcat\u7684\u5b98\u7f51\u4e0b\u8f7dTomcat\uff0c\u7136\u540e\u4e0a\u4f20\u81f3\u670d\u52a1\u5668\u89e3\u538b\u3002 https:\/\/tomcat.apache.org<\/p>\n

1.\u5c06\u4e0b\u8f7d\u7684\u8f6f\u4ef6\u5305\u89e3\u538b\r\ntar xf apache-tomcat-VERSION.tar.gz  -C \/usr\/local\/\r\ncd \/usr\/local\r\n\r\n2.\u521b\u5efa\u8f6f\u8fde\u63a5\uff0c\u6216\u8005\u5c06\u89e3\u538b\u7684tomcat\u76f4\u63a5\u6539\u540d\u4e3atomcat\u4e5f\u80fd\u8fbe\u5230\u540c\u6837\u7684\u6548\u679c\r\nln -sv apache-tomcat-VERSION  tomcat \r\n3.\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\r\nvim \/etc\/profile.d\/tomcat.sh \r\n    export CATALINA_BASE=\/usr\/local\/tomcat\r\n    export PATH=$CATALINA_BASE\/bin:$PATH  \r\n\r\n4.\u521b\u5efatomcat\u9700\u8981\u7684\u7528\u6237\r\nuseradd tomcat \r\n\r\n5.\u5c06\u5b89\u88c5\u5305\u7684\u8def\u5f84\u4e0b\u7684\u6240\u6709\u5c5e\u7ec4\u90fd\u6539\u4e3atomcat\r\nchown -R root.tomcat \/usr\/local\/tomcat                      # \u8bbe\u5b9a\u6240\u6709\u8005\u4e3aroot\uff0c\u6240\u5c5e\u7ec4\u4e3atomcat\r\nchown -R tomcat \/usr\/local\/tomcat\/{logs,temp,work,webapps}  # \u4ec5\u5c06\u9700\u8981\u6709\u5199\u6743\u9650\u6587\u4ef6\u6240\u6709\u8005\u6539\u4e3atomcat\r\nchmod g+r \/usr\/local\/tomcat\/conf                            # \u9ed8\u8ba4\u6ca1\u6709\u6743\u9650\uff0c\u4f1a\u5bfc\u81f4\u542f\u52a8\u5931\u8d25\r\n\r\n5.\u5207\u6362\u5230tomcat\u7528\u6237\u6700\u540e\u542f\u52a8\u670d\u52a1\u5373\u53ef\r\nsu - tomcat \r\ncatalina.sh start                                   # \u542f\u52a8tomcat\u3002catalina.sh\u547d\u4ee4\u9700\u8981\u5148\u6dfb\u52a0\u73af\u5883\u53d8\u91cf<\/pre>\n
\u4e09\u3001Tomcat\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\u7ed3\u6784<\/strong><\/div>\n
bin\uff1a   \u811a\u672c\u3001\u4ee5\u53caTomcat\u81ea\u8eab\u6240\u643a\u5e26\u7684\u5de5\u5177\u5305\r\nconf\uff1a  Tomcat\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\uff1b\r\nlib\uff1a   \u5e93\u6587\u4ef6\uff0cJava\u7c7b\u5e93\uff0cjar\uff1b\r\nlogs\uff1a  \u65e5\u5fd7\u6587\u4ef6\u76ee\u5f55\uff1b\r\ntemp\uff1a  \u4e34\u65f6\u6587\u4ef6\u76ee\u5f55\uff1b\r\nwebapps\uff1awebapp\u7684\u9ed8\u8ba4\u76ee\u5f55\uff1b\u76f8\u5f53\u4e8e\u9875\u9762\u7684\u6839\u76ee\u5f55\u3002\u90e8\u7f72\u7684\u5e94\u7528\u90fd\u5e94\u8be5\u5728IC\u76ee\u5f55\u4e0b\r\nwork\uff1a  \u5de5\u4f5c\u76ee\u5f55\uff0c\u5b58\u653e\u7f16\u8bd1\u540e\u7684\u5b57\u8282\u7801\u6587\u4ef6\uff1b<\/pre>\n
\u56db\u3001\u90e8\u7f72\u6d4b\u8bd5\u9875\u9762<\/strong><\/div>\n

\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u9875\u9762\uff0c\u5c06\u4e0b\u9762\u7684\u6b65\u9aa4\u5168\u90e8\u505a\u5b8c\u540e\uff0c\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eehttp:\/\/IP:8080\/test \u5373\u53ef\u8bbf\u95ee\u5230\u6d4b\u8bd5\u7684\u9875\u9762<\/p>\n

1.\u521b\u5efa\u6587\u4ef6\u5939<\/strong><\/span><\/div>\n
classes\u3001lib\u3001WEB-INF\u4e3a\u4e00\u4e2a\u6807\u51c6\u5e94\u7528\u5e94\u8be5\u6709\u7684\u76ee\u5f55\uff0c\u8fd9\u91cc\u521b\u5efa\u4ec5\u4ec5\u4e3a\u4e86\u4e0e\u6807\u51c6\u770b\u9f50\r\nmkidr  -pv  \/usr\/share\/tomcat\/webapps\/test\/{classes,lib,WEB-INF}   <\/pre>\n
2.\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u9875\u9762\u7528\u4e8e\u68c0\u9a8cTomcat\u670d\u52a1\u662f\u5426\u80fd\u6b63\u5e38\u63d0\u4f9b\u670d\u52a1<\/strong><\/span><\/div>\n
3.\u91cd\u542f\u670d\u52a1<\/strong><\/span><\/div>\n
systemctl restart tomcat<\/pre>\n
4.\u90e8\u7f72\u5b8c\u6210\u540e\u5728webapp\u76ee\u5f55\u81ea\u52a8\u751f\u6210\u4e00\u4e9b\u76ee\u5f55<\/strong><\/span><\/div>\n
cd  \/usr\/share\/tomcat\/work\/Catalina             # \u90e8\u7f72\u5b8c\u6210\u540e\u81ea\u52a8\u751f\u6210\u7684test\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\r\n[root@localhost Catalina]# tree .\r\n.\r\n\u2514\u2500\u2500 localhost                                   # \u9ed8\u8ba4\u4e3b\u673a\u7ad9\u70b9\r\n    \u251c\u2500\u2500 _\r\n    \u251c\u2500\u2500 docs\r\n    \u251c\u2500\u2500 examples\r\n    \u251c\u2500\u2500 host-manager\r\n    \u251c\u2500\u2500 manager\r\n    \u251c\u2500\u2500 sample\r\n    \u2514\u2500\u2500 test                                    # webpp\u5e94\u7528\u540d\u79f0\u3002\u81ea\u52a8\u751f\u6210\u4ee5\u4e0b\u76ee\u5f55\r\n        \u2514\u2500\u2500 org\r\n            \u2514\u2500\u2500 apache\r\n                \u2514\u2500\u2500 jsp\r\n                    \u251c\u2500\u2500 index_jsp.class\r\n                    \u2514\u2500\u2500 index_jsp.java<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.cnblogs.com\/aubin\/p\/7821345.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/tomcat-Linux.html<\/a>\u7f16\u8f91\uff1a\u5411\u91d1\u5e73\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d <\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Tomcat \u670d\u52a1\u5668\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u653e\u6e90\u4ee3\u7801\u7684Web \u5e94\u7528\u670d\u52a1\u5668\uff0c\u5c5e\u4e8e\u8f7b\u91cf\u7ea7\u5e94\u7528\u670d\u52a1\u5668\uff0c\u5728\u4e2d\u5c0f\u578b\u7cfb\u7edf\u548c\u5e76\u53d1 […]<\/p>\n","protected":false},"author":1482,"featured_media":98480,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-98318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/98318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=98318"}],"version-history":[{"count":21,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/98318\/revisions"}],"predecessor-version":[{"id":291997,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/98318\/revisions\/291997"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/98480"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=98318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=98318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=98318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}