{"id":295361,"date":"2025-01-03T12:05:04","date_gmt":"2025-01-03T04:05:04","guid":{"rendered":"https:\/\/lrxjmw.cn\/tpzxjcmcylyy.html"},"modified":"2025-01-03T12:05:04","modified_gmt":"2025-01-03T04:05:04","slug":"tpzxjcmcylyy","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/tpzxjcmcylyy.html","title":{"rendered":"Tomcat\u914d\u7f6e\u8be6\u89e3\uff1a\u4ece\u540d\u79f0\u7531\u6765\u3001\u5e94\u7528\u573a\u666f\u5230\u5f00\u53d1\u6d4b\u8bd5\u9996\u9009"},"content":{"rendered":"

\u76ee\u5f55\u4e8c\u3001Tomcat<\/a>\u7684\u914d\u7f6e\u76f8\u5173\u8bf4\u660e<\/p>\n

\u4e00\u3001tomcat\u7684\u6765\u5386<\/p>\n

\u540d\u79f0\u6765\u5386\uff1atomcat\u6700\u521d\u662f\u7531Sun\u7684\u8f6f\u4ef6\u6784\u67b6\u5e08\u8a79\u59c6\u65af\u9093\u80af\u6234\u7ef4\u68ee\u5f00\u53d1\u7684\u3002\u540e\u6765\u4ed6\u5e2e\u52a9\u5c06\u5176\u53d8\u4e3a\u5f00\u6e90\u9879\u76ee\uff0c\u5e76\u7531Sun\u8d21\u732e\u7ed9Apache\u8f6f\u4ef6\u57fa\u91d1\u4f1a\u3002\u56e0\u4e3a\u5927\u90e8\u5206\u5f00\u6e90\u9879\u76eeO'Reilly\u5c31\u4f1a\u51fa\u4e00\u672c\u76f8\u5173\u7684\u4e66centos\u914d\u7f6etomcat<\/strong>\uff0c\u800c\u4e14\u5c06\u5176\u5c01\u9762\u8bbe\u8ba1\u6210\u67d0\u4e2a\u690d\u7269\u7684\u7ed8\u753b\uff0c\u56e0\u800c\u4ed6\u5e0c\u671b\u5c06\u6b64\u9879\u76ee\u4ee5\u4e00\u4e2a\u690d\u7269\u7684\u540d\u5b50\u547d\u540d\u3002\u7531\u4e8e\u4ed6\u5e0c\u671b\u8fd9\u4e9b\u690d\u7269\u5c31\u80fd\u81ea\u5df1\u7167\u6599\u81ea\u5df1\uff0c\u6700\u7ec8\uff0c\u4ed6\u5c06\u5176\u547d\u540d\u4e3atomcat\uff08\u6bcd\u72d7\uff09\u3002<\/p>\n

1\u3001Tomcat\u5e94\u7528\u573a\u666f<\/p>\n

Tomcat\u670d\u52a1\u5668\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u6e90web\u5e94\u7528\u670d\u52a1\u5668\uff0c\u5c5e\u4e8e\u8f7b\u91cf\u7ea7\u5e94\u7528\u670d\u52a1\u5668centos\u914d\u7f6etomcat<\/strong>\uff0c\u5728\u4e2d\u5927\u578b\u7cfb\u7edf\u548c\u5e76\u53d1\u7528\u6237\u4e0d\u662f\u597d\u591a\u7684\u573a\u5408\u4e2d\u88ab\u666e\u904d\u4f7f\u7528\uff0c\u662f\u5f00\u53d1\u548c\u6d4b\u8bd5JSP\u7a0b\u5e8f\u7684\u9996\u9009\u3002\u901a\u5e38\u6765\u8bf4\uff0cTomcat\u4f3c\u4e4e\u548capache<\/a>\u6216\u5219Nginx\u8fd9\u79cdweb\u670d\u52a1\u5668\u4e00\u6837\uff0c\u5177\u6709\u5904\u7406HTML\u9875\u9762\u7684\u529f\u80fd\uff0c\u4f46\u662f\u56e0\u4e3a\u5176\u5904\u7406\u9759\u6001\u9875\u9762\u7684\u80fd\u529b\u8fdc\u4e0d\u5982apache\u6216\u5219Nginx\uff0c\u6240\u4ee5Tomcat\u901a\u5e38\u662f\u4f5c\u4e3a\u4e00\u4e2aservlet\u548cJSP\u5bb9\u5668\uff0c\u5355\u72ec\u8fd0\u884c\u5728\u524d\u7aef\u3002<\/p>\n

2\u3001Tomcat\u6240\u9700\u7684\u4f9d\u8d56\u8f6f\u4ef6<\/p>\n

\u5728\u5b89\u88c5Tomcat\u4e4b\u524d\u5fc5\u987b\u5b89\u88c5JDK\uff0cJDK\u662fsun\u516c\u53f8\u514d\u8d39\u63d0\u4f9b\u7684Java\u8bed\u8a00\u7684\u8f6f\u4ef6\u5f00\u53d1\u5de5\u5177\u5305\uff0c\u5176\u4e2d\u5305\u542bJava\u865a\u62df\u673a\uff08JVM\uff09\u3002\u7f16\u64b0\u597d\u7684Java\u6e90\u7a0b\u5e8f\u7ecf\u8fc7\u7f16\u8bd1\u53ef\u4ea7\u751fJava\u5b57\u8282\u7801\uff0c\u53ea\u8981\u5b89\u88c5\u4e86JDK\u5c31\u53ef\u4ee5\u501f\u52a9JVM\u89e3\u91ca\u90a3\u4e9b\u5b57\u7801\u6587\u4ef6\uff0c\u56e0\u800c\u4fdd\u8bc1Java\u7684\u8de8\u5e73\u53f0\u6027\u3002<\/p>\n

\u5728\u5e73\u53f0\u517c\u5bb9\u6027\u65b9\u9762\uff0cJDK\u4f5c\u4e3a\u89e3\u91ca\u5b57\u8282\u7801\u6587\u4ef6\u5e76\u636e\u6b64\u8c03\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684API\u5b9e\u73b0\u5bf9\u5e94\u529f\u80fd\u7684Java\u865a\u62df\u673a\uff0c\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\u548c\u5e73\u53f0\u4f4d\u6570\u5bc6\u5207\u76f8\u5173linux\u7cfb\u7edf\uff0c\u56e0\u800c\u5b58\u5728\u4e0d\u540c\u7c7b\u578b\u7684\u7248\u672c\uff0c\u800cTomcat\u4e5f\u5177\u6709\u8fd9\u79cd\u7279\u70b9\uff0c\uff08Centos7.0\u9ed8\u8ba4\u60c5\u51b5\u4e0bJDK\u65e9\u5df2\u5b89\u88c5\uff0c\u5047\u5982\u8981\u662fCentos6.0\u64cd\u4f5c\u7cfb\u7edf\u5c31\u987b\u8981\u81ea\u884c\u5b89\u88c5\u4e86\uff09\u3002<\/p>\n

1\uff09\u67e5\u770bJDK\u662f\u5426\u5b89\u88c5<\/p>\n

\n

\n[root@centos02 ~]# java -version\nopenjdk version \"1.8.0_131\"\nOpenJDK Runtime Environment (build 1.8.0_131-b12)\nOpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)<\/pre>\n<\/p>\n

2\uff09Centos6.0\u5b89\u88c5JDK<\/p>\n

\n

\n[root@centos02 ~]# mount \/dev\/cdrom \/mnt\/ \nmount: \/dev\/sr0 \u5199\u4fdd\u62a4\uff0c\u5c06\u4ee5\u53ea\u8bfb\u65b9\u5f0f\u6302\u8f7d\n[root@centos02 ~]# tar zxvf \/mnt\/jdk-7u65-linux-x64.gz -C \/usr\/src\/ \n  \n[root@centos02 src]# ls\ndebug jdk1.7.0_65 kernels\n[root@centos02 src]# mv jdk1.7.0_65\/ \/usr\/src\/java \n[root@centos02 ~]# vim \/etc\/profile.d\/java.sh\nexport JAVA_HOME=\/usr\/local\/java\nexport PATH=$PATH:$JAVA_HOME\/bin\n[root@centos02 ~]# chmod +x \/etc\/profile.d\/java.sh\n[root@centos02 ~]# source \/etc\/profile.d\/java.sh <\/pre>\n<\/p>\n

\u4e8c\u3001Tomcat\u7684\u914d\u7f6e\u76f8\u5173\u8bf4\u660e1\u3001Tomcat\u7684\u4e3b\u8981\u76ee\u5f55<\/p>\n

tomcat\u7684\u4e3b\u8981\u76ee\u5f55\u4e3a\/usr\/local\/tomcat8\/\u3002<\/p>\n

\n

\n[root@centos02 ~]# cd \/usr\/local\/tomcat\/\n[root@centos02 tomcat]# ll\n\u603b\u7528\u91cf 96\ndrwxr-xr-x 2 root root 4096 11\u6708 30 19:48 bin\ndrwxr-xr-x 3 root root 174 11\u6708 30 20:03 conf\ndrwxr-xr-x 2 root root 4096 11\u6708 30 19:48 lib\n-rw-r--r-- 1 root root 56812 5\u6708 20 2014 LICENSE\ndrwxr-xr-x 2 root root 197 11\u6708 30 19:51 logs\n

tomcat\u914d\u7f6etomcat_centos\u914d\u7f6etomcat_\u914d\u7f6ecentos\u865a\u62df\u673a<\/p>\n-rw-r--r-- 1 root root 1192 5\u6708 20 2014 NOTICE\n-rw-r--r-- 1 root root 8974 5\u6708 20 2014 RELEASE-NOTES\n-rw-r--r-- 1 root root 16204 5\u6708 20 2014 RUNNING.txt\ndrwxr-xr-x 2 root root 30 11\u6708 30 19:48 temp\ndrwxr-xr-x 7 root root 81 5\u6708 20 2014 webapps\ndrwxr-xr-x 3 root root 22 11\u6708 30 19:51 work<\/pre>\n<\/p>\n

\u4e3b\u8981\u76ee\u5f55\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n

|---bin\/\uff1a\u50a8\u5b58Windows\u6216Linux<\/a>\u5e73\u53f0\u4e0a\u542f\u52a8\u548c\u5173\u6389Tomcat\u7684\u811a\u672c\u6587\u4ef6\uff1b<\/p>\n

|---conf\/\uff1a\u50a8\u5b58Tomcat\u670d\u52a1\u5668\u7684\u5404\u7c7b\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u6700\u91cd\u8981\u7684\u662fserver<\/a>.xml\u548cweb.xml\uff1b<\/p>\n

|---lib\/\uff1a\u50a8\u5b58Tomcat\u8fd0\u884c\u987b\u8981\u7684\u5e93\u6587\u4ef6\uff1b<\/p>\n

|---logs\/\uff1a\u50a8\u5b58Tomcat\u6267\u884c\u65f6\u7684LOG\u6587\u4ef6\uff1b<\/p>\n

|---webapps\uff1aTomcat\u7684\u4e3b\u8981web\u53d1\u5e03\u76ee\u5f55\uff08\u5305\u62ec\u5e94\u7528\u7a0b\u5e8f\u793a\u4f8b\uff09\uff1b<\/p>\n

|---work\uff1a\u50a8\u5b58JSP\u7f16\u8bd1\u540e\u5f62\u6210\u7684class\u6587\u4ef6\uff1b<\/p>\n

2\u3001\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e<\/p>\n

\n

\n[root@centos02 tomcat]# ll conf\/\n\u603b\u7528\u91cf 200\ndrwxr-xr-x 3 root root 23 11\u6708 30 19:51 Catalina\n-rw------- 1 root root 12257 5\u6708 20 2014 catalina.policy\n

tomcat\u914d\u7f6etomcat_centos\u914d\u7f6etomcat_\u914d\u7f6ecentos\u865a\u62df\u673a<\/p>\n-rw------- 1 root root 6294 5\u6708 20 2014 catalina.properties\n-rw------- 1 root root 1394 5\u6708 20 2014 context.xml\n-rw------- 1 root root 3288 5\u6708 20 2014 logging.properties\n-rw------- 1 root root 6610 11\u6708 30 20:03 server.xml\n-rw------- 1 root root 1530 5\u6708 20 2014 tomcat-users.xml\n-rw------- 1 root root 163385 5\u6708 20 2014 web.xml<\/pre>\n<\/p>\n

\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n

catalina.policy\uff1a\u6743\u9650\u63a7\u5236\u914d\u7f6e\u6587\u4ef6\uff1b<\/p>\n

catalina.properties\uff1aTomcat\u5c5e\u6027\u914d\u7f6e\u6587\u4ef6\uff1b<\/p>\n

context.xml\uff1a\u4e0a\u4e0b\u6587\u914d\u7f6e\u6587\u4ef6\uff1b<\/p>\n

logging.properties\uff1a\u65e5\u5fd7log\u76f8\u5173\u914d\u7f6e\u6587\u4ef6\uff1b<\/p>\n

server.xml\uff1a\u4e3b\u914d\u7f6e\u6587\u4ef6\uff1b<\/p>\n

tomcat-users.xml\uff1amanager-gui\u7ba1\u7406\u7528\u6237\u914d\u7f6e\u6587\u4ef6\uff08Tomcatt\u5b89\u88c5\u540e\u63d0\u4f9b\u4e00\u4e2amanager-gui\u7684\u7ba1\u7406\u754c\u9762\uff0c\u901a\u8fc7\u914d\u7f6e\u8be5\u6587\u4ef6\u53ef\u4ee5\u5f00\u542f\u8bbf\u95ee\uff09\uff1b<\/p>\n

web.xml\uff1aTomcat\u7684servlet\u3001servlet-mapping\u3001filter\u3001MIME\u7b49\u76f8\u5173\u914d\u7f6e\uff1b<\/p>\n

3\u3001Tomcat\u4e3b\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e<\/p>\n

server.xml\u4e3aTomcat\u7684\u4e3b\u8981\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u8fc7\u914d\u7f6e\u8be5\u6587\u4ef6\uff0c\u53ef\u4ee5\u66f4\u6539Tomcat\u7684\u542f\u52a8\u7aef\u53e3\u3001\u7f51\u7ad9\u76ee\u5f55\u3001\u865a\u62df\u4e3b\u673a\u3001\u5f00\u542fhttps\u7b49\u91cd\u8981\u529f\u80fd\u3002<\/p>\n

\u6574\u4e2aserver.xml\u7531\u4ee5\u4e0b\u7ed3\u6784\u6784\u6210\uff1a\u3001\u3001\u3001\u3001\u3001\u548c\u3002<\/p>\n

\u4ee5\u4e0b\u662f\u9ed8\u8ba4\u5b89\u88c5server.xml\u6587\u4ef6\u7684\u90e8\u4efd\u5185\u5bb9\uff0c\u5176\u4e2d\u5185\u7684\u5185\u5bb9\u65f6\u6ce8\u91ca\u4fe1\u606f\u3002\/\/\u53f7\u5f00\u5934\u662f\u6211\u81ea\u884c\u8fdb\u884c\u7684\u6279\u6ce8\uff1a<\/p>\n

\n

\n

\u914d\u7f6ecentos\u865a\u62df\u673a_tomcat\u914d\u7f6etomcat_centos\u914d\u7f6etomcat<\/p>\n[root@Centos01 tomcat8]# vim conf\/server.xml\n\n............ \/\/\u7701\u7565\u90e8\u5206\u5185\u5bb9\n \n\/\/Tomcat\u5173\u95ed\u7aef\u53e3\uff0c\u9ed8\u8ba4\u53ea\u5bf9\u672c\u673a\u5730\u5740\u5f00\u653e\uff0c\u53ef\u4ee5\u5728\u672c\u673a\u901a\u8fc7Telnet 127.0.0.1 8005\u8bbf\u95ee\uff0c\n\/\/\u5bf9Tomcat\u8fdb\u884c\u5173\u95ed\u64cd\u4f5c\n............ \/\/\u6b64\u5904\u7701\u7565\u90e8\u5206\u5185\u5bb9\n \n\/\/Tomcat\u542f\u52a8\u7684\u9ed8\u8ba4\u7aef\u53e3\u53f78080\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u66f4\u6539\u3002\n............ \/\/\u6b64\u5904\u7701\u7565\u90e8\u5206\u5185\u5bb9\n \n \n\/\/Tomcat\u542f\u52a8AJP 1.3\u8fde\u63a5\u5668\u65f6\u9ed8\u8ba4\u7684\u7aef\u53e3\u53f7\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u66f4\u6539\n............ \/\/\u6b64\u5904\u7701\u7565\u90e8\u5206\u5185\u5bb9\n\/\/\u4ee5\u4e0b\u4e3aTomcat\u5b9a\u4e49\u865a\u62df\u4e3b\u673a\u65f6\u7684\u914d\u7f6e\u53ca\u65e5\u5fd7\u914d\u7f6e\n\n \n \n \n <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"\n

tomcat\u914d\u7f6etomcat_\u914d\u7f6ecentos\u865a\u62df\u673a_centos\u914d\u7f6etomcat<\/p>\n prefix=\"localhost_access_log\" suffix=\".txt\"\n pattern=\"%h %l %u %t \"%r\" %s %b\" \/>\n \n \n \n<\/pre>\n<\/p>\n

4\u3001Tomcatserver\u7684\u7ec4\u6210\u90e8\u4efd\u8bf4\u660e<\/p>\n

1\uff09Server<\/p>\n

server\u5143\u7d20\u4ee3\u8868\u4e86\u6574\u4e2aCatAlina\u7684servlet\u5bb9\u5668\u3002<\/p>\n

2\uff09Service<\/p>\n

Service\u662f\u8fd9\u6837\u4e00\u4e2a\u96c6\u5408\uff1a\u5b83\u7531\u4e00\u4e2a\u6216\u5219\u591a\u4e2aConnector\u767e\u5ea6\u7f51\u76d8LINUX\uff0c\u4ee5\u53ca\u4e00\u4e2aEngine\uff08\u8d1f\u8d23\u5904\u7406\u6240\u6709Connector\u6240\u83b7\u5f97\u7684\u987e\u5ba2\u6073\u6c42\uff09\u7ec4\u6210\u3002<\/p>\n

3\uff09Connector<\/p>\n

\u4e00\u4e2aConnector\u5728\u67d0\u4e2a\u6307\u5b9a\u7aef\u53e3\u4e0a\u4fa6\u542c\u987e\u5ba2\u6073\u6c42\uff0c\u5e76\u5c06\u83b7\u5f97\u7684\u6073\u6c42\u4ea4\u7ed9Engine\u6765\u5904\u7406,\u4eceEngine\u5904\u83b7\u5f97\u56de\u5e94\u5e76\u8fd4\u56de\u987e\u5ba2\u3002<\/p>\n

Tomcat\u6709\u4e24\u4e2a\u5178\u578b\u7684Connector\uff0c\u4e00\u4e2a\u76f4\u63a5\u4fa6\u542c\u6765\u81eabrowser\u7684http\u6073\u6c42\uff0c\u4e00\u4e2a\u4fa6\u542c\u6765\u81ea\u5176\u4ed6webserver\u7684\u6073\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

|—conf\/\uff1a\u5b58\u653eTomcat\u670d\u52a1\u5668\u7684\u5404\u79cd\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u6700\u91cd\u8981\u7684\u662fserver.xml\u548cweb.xml\uff1b|—webapps\uff1aTomcat\u7684\u4e3b\u8981web\u53d1\u5e03\u76ee\u5f55\uff08\u5305\u62ec\u5e94\u7528\u7a0b\u5e8f\u793a\u4f8b\uff09\uff1bserver.xml\uff1a\u4e3b\u914d\u7f6e\u6587\u4ef6\uff1b<\/p>\n","protected":false},"author":1,"featured_media":295362,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[383,1181,1448,4877,3918],"class_list":["post-295361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-apache","tag-j","tag-n-5","tag-server","tag-Tomcat"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295361","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=295361"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295361\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/295362"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=295361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=295361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=295361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}