{"id":156264,"date":"2019-09-05T09:07:16","date_gmt":"2019-09-05T01:07:16","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=156264"},"modified":"2019-08-21T14:09:16","modified_gmt":"2019-08-21T06:09:16","slug":"tomcat-install-configure","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/tomcat-install-configure.html","title":{"rendered":"Tomcat\u5b89\u88c5\u53ca\u914d\u7f6e\u8be6\u89e3\uff08\u4e00\uff09"},"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\uff0cTomcat\u662fApache \u8f6f\u4ef6\u57fa\u91d1\u4f1a\uff08Apache Software Foundation\uff09\u7684Jakarta \u9879\u76ee\u4e2d\u7684\u4e00\u4e2a\u6838\u5fc3\u9879\u76ee\uff0c\u5b83\u65e9\u671f\u7684\u540d\u79f0\u4e3acatalina\uff0c\u540e\u6765\u7531Apache\u3001Sun \u548c\u5176\u4ed6\u4e00\u4e9b\u516c\u53f8\u53ca\u4e2a\u4eba\u5171\u540c\u5f00\u53d1\u800c\u6210\uff0c\u5e76\u66f4\u540d\u4e3aTomcat\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
Tomcat\u7b80\u4ecb<\/strong><\/div>\n

Tomcat \u670d\u52a1\u5668\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u653e\u6e90\u4ee3\u7801\u7684Web \u5e94\u7528\u670d\u52a1\u5668\uff0cTomcat\u662fApache \u8f6f\u4ef6\u57fa\u91d1\u4f1a\uff08Apache Software Foundation\uff09\u7684Jakarta \u9879\u76ee\u4e2d\u7684\u4e00\u4e2a\u6838\u5fc3\u9879\u76ee\uff0c\u5b83\u65e9\u671f\u7684\u540d\u79f0\u4e3acatalina\uff0c\u540e\u6765\u7531Apache\u3001Sun \u548c\u5176\u4ed6\u4e00\u4e9b\u516c\u53f8\u53ca\u4e2a\u4eba\u5171\u540c\u5f00\u53d1\u800c\u6210\uff0c\u5e76\u66f4\u540d\u4e3aTomcat\u3002Tomcat \u662f\u4e00\u4e2a\u5c0f\u578b\u7684\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\uff0c\u56e0\u4e3aTomcat \u6280\u672f\u5148\u8fdb\u3001\u6027\u80fd\u7a33\u5b9a\uff0c\u6210\u4e3a\u76ee\u524d\u6bd4\u8f83\u6d41\u884c\u7684Web \u5e94\u7528\u670d\u52a1\u5668\u3002Tomcat\u662f\u5e94\u7528\uff08java\uff09\u670d\u52a1\u5668\uff0c\u5b83\u53ea\u662f\u4e00\u4e2aservlet\u5bb9\u5668\uff0c\u662fApache\u7684\u6269\u5c55\uff0c\u4f46\u5b83\u662f\u72ec\u7acb\u8fd0\u884c\u7684\u3002\u76ee\u524d\u6700\u65b0\u7684\u7248\u672c\u4e3aTomcat 8.0.24 Released\u3002<\/p>\n

Tomcat\u4e0d\u662f\u4e00\u4e2a\u5b8c\u6574\u610f\u4e49\u4e0a\u7684Jave EE\u670d\u52a1\u5668\uff0c\u5b83\u751a\u81f3\u90fd\u6ca1\u6709\u63d0\u4f9b\u5bf9\u54ea\u6015\u662f\u4e00\u4e2a\u4e3b\u8981Java EE API\u7684\u5b9e\u73b0\uff1b\u4f46\u7531\u4e8e\u9075\u5b88apache\u5f00\u6e90\u534f\u8bae\uff0ctomcat\u5374\u53c8\u4e3a\u4f17\u591a\u7684java\u5e94\u7528\u7a0b\u5e8f\u670d\u52a1\u5668\u5d4c\u5165\u81ea\u5df1\u7684\u4ea7\u54c1\u4e2d\u6784\u5efa\u5546\u4e1a\u7684java\u5e94\u7528\u7a0b\u5e8f\u670d\u52a1\u5668\uff0c\u5982JBoss\u548cJOnAS\u3002\u5c3d\u7ba1Tomcat\u5bf9Jave EE API\u7684\u5b9e\u73b0\u5e76\u4e0d\u5b8c\u6574\uff0c\u7136\u800c\u5f88\u4f01\u4e1a\u4e5f\u5728\u6e10\u6e10\u629b\u5f03\u4f7f\u7528\u4f20\u7edf\u7684Java EE\u6280\u672f\uff08\u5982EJB\uff09\u8f6c\u800c\u91c7\u7528\u4e00\u4e9b\u5f00\u6e90\u7ec4\u4ef6\u6765\u6784\u5efa\u590d\u6742\u7684\u5e94\u7528\u3002\u8fd9\u4e9b\u5f00\u6e90\u7ec4\u4ef6\u5982Structs\u3001Spring\u548cHibernate\uff0c\u800cTomcat\u80fd\u591f\u5bf9\u8fd9\u4e9b\u7ec4\u4ef6\u5b9e\u73b0\u5b8c\u7f8e\u7684\u652f\u6301\u3002<\/p>\n

Tomcat\u7684\u67b6\u6784<\/strong><\/div>\n

Tomcat 6\u652f\u6301Servlet 2.5\u548cJSP 2.1\u7684\u89c4\u8303\uff0c\u5b83\u7531\u4e00\u7ec4\u5d4c\u5957\u7684\u5c42\u6b21\u548c\u7ec4\u4ef6\u7ec4\u6210\uff0c\u4e00\u822c\u53ef\u5206\u4e3a\u4ee5\u4e0b\u56db\u7c7b\uff1a<\/p>\n

\u9876\u7ea7\u7ec4\u4ef6\uff1a\u4f4d\u4e8e\u914d\u7f6e\u5c42\u6b21\u7684\u9876\u7ea7\uff0c\u5e76\u4e14\u5f7c\u6b64\u95f4\u6709\u7740\u4e25\u683c\u7684\u5bf9\u5e94\u5173\u7cfb\uff1b<\/p>\n

\u8fde\u63a5\u5668\uff1a\u8fde\u63a5\u5ba2\u6237\u7aef\uff08\u53ef\u4ee5\u662f\u6d4f\u89c8\u5668\u6216Web\u670d\u52a1\u5668\uff09\u8bf7\u6c42\u81f3Servlet\u5bb9\u5668\uff0c<\/p>\n

\u5bb9\u5668\uff1a\u5305\u542b\u4e00\u7ec4\u5176\u5b83\u7ec4\u4ef6\uff1b<\/p>\n

\u88ab\u5d4c\u5957\u7684\u7ec4\u4ef6\uff1a\u4f4d\u4e8e\u4e00\u4e2a\u5bb9\u5668\u5f53\u4e2d\uff0c\u4f46\u4e0d\u80fd\u5305\u542b\u5176\u5b83\u7ec4\u4ef6\uff1b<\/p>\n

\u5404\u5e38\u89c1\u7ec4\u4ef6<\/strong><\/span><\/div>\n

1\u3001\u670d\u52a1\u5668(server)\uff1aTomcat\u7684\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u901a\u5e38\u4e00\u4e2aJVM\u53ea\u80fd\u5305\u542b\u4e00\u4e2aTomcat\u5b9e\u4f8b\uff1b\u56e0\u6b64\uff0c\u4e00\u53f0\u7269\u7406\u670d\u52a1\u5668\u4e0a\u53ef\u4ee5\u5728\u542f\u52a8\u591a\u4e2aJVM\u7684\u60c5\u51b5\u4e0b\u5728\u6bcf\u4e00\u4e2aJVM\u4e2d\u542f\u52a8\u4e00\u4e2aTomcat\u5b9e\u4f8b\uff0c\u6bcf\u4e2a\u5b9e\u4f8b\u5206\u5c5e\u4e8e\u4e00\u4e2a\u72ec\u7acb\u7684\u7ba1\u7406\u7aef\u53e3\u3002\u8fd9\u662f\u4e00\u4e2a\u9876\u7ea7\u7ec4\u4ef6\u3002<\/p>\n

2\u3001\u670d\u52a1(service)\uff1a\u4e00\u4e2a\u670d\u52a1\u7ec4\u4ef6\u901a\u5e38\u5305\u542b\u4e00\u4e2a\u5f15\u64ce\u548c\u4e0e\u6b64\u5f15\u64ce\u76f8\u5173\u8054\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u8fde\u63a5\u5668\u3002\u7ed9\u670d\u52a1\u547d\u540d\u53ef\u4ee5\u65b9\u4fbf\u7ba1\u7406\u5458\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\u8bc6\u522b\u4e0d\u540c\u670d\u52a1\u4ea7\u751f\u7684\u65e5\u5fd7\u3002\u4e00\u4e2aserver\u53ef\u4ee5\u5305\u542b\u591a\u4e2aservice\u7ec4\u4ef6\uff0c\u4f46\u901a\u5e38\u60c5\u4e0b\u53ea\u4e3a\u4e00\u4e2aservice\u6307\u6d3e\u4e00\u4e2aserver\u3002<\/p>\n

\u8fde\u63a5\u5668\u7c7b\u7ec4\u4ef6\uff1a<\/p>\n

3\u3001\u8fde\u63a5\u5668(connectors)\uff1a\u8d1f\u8d23\u8fde\u63a5\u5ba2\u6237\u7aef\uff08\u53ef\u4ee5\u662f\u6d4f\u89c8\u5668\u6216Web\u670d\u52a1\u5668\uff09\u8bf7\u6c42\u81f3Servlet\u5bb9\u5668\u5185\u7684Web\u5e94\u7528\u7a0b\u5e8f\uff0c\u901a\u5e38\u6307\u7684\u662f\u63a5\u6536\u5ba2\u6237\u53d1\u6765\u8bf7\u6c42\u7684\u4f4d\u7f6e\u53ca\u670d\u52a1\u5668\u7aef\u5206\u914d\u7684\u7aef\u53e3\u3002\u9ed8\u8ba4\u7aef\u53e3\u901a\u5e38\u662fHTTP\u534f\u8bae\u76848080\uff0c\u7ba1\u7406\u5458\u4e5f\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u6539\u53d8\u6b64\u7aef\u53e3\u3002\u4e00\u4e2a\u5f15\u64ce\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a\u8fde\u63a5\u5668\uff0c\u4f46\u8fd9\u4e9b\u8fde\u63a5\u5668\u5fc5\u987b\u4f7f\u7528\u4e0d\u540c\u7684\u7aef\u53e3\u3002\u9ed8\u8ba4\u7684\u8fde\u63a5\u5668\u662f\u57fa\u4e8eHTTP\/1.1\u7684Coyote\u3002\u540c\u65f6\uff0cTomcat\u4e5f\u652f\u6301AJP\u3001JServ\u548cJK2\u8fde\u63a5\u5668\u3002<\/p>\n

\u5bb9\u5668\u7c7b\u7ec4\u4ef6<\/strong><\/span><\/div>\n

4\u3001\u5f15\u64ce(Engine)\uff1a\u5f15\u64ce\u901a\u662f\u6307\u5904\u7406\u8bf7\u6c42\u7684Servlet\u5f15\u64ce\u7ec4\u4ef6\uff0c\u5373Catalina Servlet\u5f15\u64ce\uff0c\u5b83\u68c0\u67e5\u6bcf\u4e00\u4e2a\u8bf7\u6c42\u7684HTTP\u9996\u90e8\u4fe1\u606f\u4ee5\u8fa8\u522b\u6b64\u8bf7\u6c42\u5e94\u8be5\u53d1\u5f80\u54ea\u4e2ahost\u6216context\uff0c\u5e76\u5c06\u8bf7\u6c42\u5904\u7406\u540e\u7684\u7ed3\u679c\u8fd4\u56de\u7684\u76f8\u5e94\u7684\u5ba2\u6237\u7aef\u3002\u4e25\u683c\u610f\u4e49\u4e0a\u6765\u8bf4\uff0c\u5bb9\u5668\u4e0d\u5fc5\u975e\u5f97\u901a\u8fc7\u5f15\u64ce\u6765\u5b9e\u73b0\uff0c\u5b83\u4e5f\u53ef\u4ee5\u662f\u53ea\u662f\u4e00\u4e2a\u5bb9\u5668\u3002\u5982\u679cTomcat\u88ab\u914d\u7f6e\u6210\u4e3a\u72ec\u7acb\u670d\u52a1\u5668\uff0c\u9ed8\u8ba4\u5f15\u64ce\u5c31\u662f\u5df2\u7ecf\u5b9a\u4e49\u597d\u7684\u5f15\u64ce\u3002\u800c\u5982\u679cTomcat\u88ab\u914d\u7f6e\u4e3aApache Web\u670d\u52a1\u5668\u7684\u63d0\u4f9bServlet\u529f\u80fd\u7684\u540e\u7aef\uff0c\u9ed8\u8ba4\u5f15\u64ce\u5c06\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3aWeb\u670d\u52a1\u5668\u81ea\u8eab\u5c31\u80fd\u786e\u5b9a\u5c06\u7528\u6237\u8bf7\u6c42\u53d1\u5f80\u4f55\u5904\u3002\u4e00\u4e2a\u5f15\u64ce\u53ef\u4ee5\u5305\u542b\u591a\u4e2ahost\u7ec4\u4ef6\u3002<\/p>\n

5\u3001\u4e3b\u673a(Host)\uff1a\u4e3b\u673a\u7ec4\u4ef6\u7c7b\u4f3c\u4e8eApache\u4e2d\u7684\u865a\u62df\u4e3b\u673a\uff0c\u4f46\u5728Tomcat\u4e2d\u53ea\u652f\u6301\u57fa\u4e8eFQDN\u7684\u201c\u865a\u62df\u4e3b\u673a\u201d\u3002\u4e00\u4e2a\u5f15\u64ce\u81f3\u5c11\u8981\u5305\u542b\u4e00\u4e2a\u4e3b\u673a\u7ec4\u4ef6\u3002<\/p>\n

6\u3001\u4e0a\u4e0b\u6587(Context)\uff1aContext\u7ec4\u4ef6\u662f\u6700\u5185\u5c42\u6b21\u7684\u7ec4\u4ef6\uff0c\u5b83\u8868\u793aWeb\u5e94\u7528\u7a0b\u5e8f\u672c\u8eab\u3002\u914d\u7f6e\u4e00\u4e2aContext\u6700\u4e3b\u8981\u7684\u662f\u6307\u5b9aWeb\u5e94\u7528\u7a0b\u5e8f\u7684\u6839\u76ee\u5f55\uff0c\u4ee5\u4fbfServlet\u5bb9\u5668\u80fd\u591f\u5c06\u7528\u6237\u8bf7\u6c42\u53d1\u5f80\u6b63\u786e\u7684\u4f4d\u7f6e\u3002Context\u7ec4\u4ef6\u4e5f\u53ef\u5305\u542b\u81ea\u5b9a\u4e49\u7684\u9519\u8bef\u9875\uff0c\u4ee5\u5b9e\u73b0\u5728\u7528\u6237\u8bbf\u95ee\u53d1\u751f\u9519\u8bef\u65f6\u63d0\u4f9b\u53cb\u597d\u7684\u63d0\u793a\u4fe1\u606f\u3002<\/p>\n

\u88ab\u5d4c\u5957\u7c7b(nested)\u7ec4\u4ef6<\/strong><\/div>\n

\u8fd9\u7c7b\u7ec4\u4ef6\u901a\u5e38\u5305\u542b\u4e8e\u5bb9\u5668\u7c7b\u7ec4\u4ef6\u4e2d\u4ee5\u63d0\u4f9b\u5177\u6709\u7ba1\u7406\u529f\u80fd\u7684\u670d\u52a1\uff0c\u5b83\u4eec\u4e0d\u80fd\u5305\u542b\u5176\u5b83\u7ec4\u4ef6\uff0c\u4f46\u6709\u4e9b\u5374\u53ef\u4ee5\u7531\u4e0d\u540c\u5c42\u6b21\u7684\u5bb9\u5668\u5404\u81ea\u914d\u7f6e\u3002<\/p>\n

7\u3001\u9600\u95e8(Valve)\uff1a\u7528\u6765\u62e6\u622a\u8bf7\u6c42\u5e76\u5728\u5c06\u5176\u8f6c\u81f3\u76ee\u6807\u4e4b\u524d\u8fdb\u884c\u67d0\u79cd\u5904\u7406\u64cd\u4f5c\uff0c\u7c7b\u4f3c\u4e8eServlet\u89c4\u8303\u4e2d\u5b9a\u4e49\u7684\u8fc7\u6ee4\u5668\u3002Valve\u53ef\u4ee5\u5b9a\u4e49\u5728\u4efb\u4f55\u5bb9\u5668\u7c7b\u7684\u7ec4\u4ef6\u4e2d\u3002Valve\u5e38\u88ab\u7528\u6765\u8bb0\u5f55\u5ba2\u6237\u7aef\u8bf7\u6c42\u3001\u5ba2\u6237\u7aefIP\u5730\u5740\u548c\u670d\u52a1\u5668\u7b49\u4fe1\u606f\uff0c\u8fd9\u79cd\u5904\u7406\u6280\u672f\u901a\u5e38\u88ab\u79f0\u4f5c\u8bf7\u6c42\u8f6c\u50a8(request dumping)\u3002\u8bf7\u6c42\u8f6c\u50a8valve\u8bb0\u5f55\u8bf7\u6c42\u5ba2\u6237\u7aef\u8bf7\u6c42\u6570\u636e\u5305\u4e2d\u7684HTTP\u9996\u90e8\u4fe1\u606f\u548ccookie\u4fe1\u606f\u6587\u4ef6\u4e2d\uff0c\u54cd\u5e94\u8f6c\u50a8valve\u5219\u8bb0\u5f55\u54cd\u5e94\u6570\u636e\u5305\u9996\u90e8\u4fe1\u606f\u548ccookie\u4fe1\u606f\u81f3\u6587\u4ef6\u4e2d\u3002<\/p>\n

8\u3001\u65e5\u5fd7\u8bb0\u5f55\u5668(Logger)\uff1a\u7528\u4e8e\u8bb0\u5f55\u7ec4\u4ef6\u5185\u90e8\u7684\u72b6\u6001\u4fe1\u606f\uff0c\u53ef\u88ab\u7528\u4e8e\u9664Context\u4e4b\u5916\u7684\u4efb\u4f55\u5bb9\u5668\u4e2d\u3002\u65e5\u5fd7\u8bb0\u5f55\u7684\u529f\u80fd\u53ef\u88ab\u7ee7\u627f\uff0c\u56e0\u6b64\uff0c\u4e00\u4e2a\u5f15\u64ce\u7ea7\u522b\u7684Logger\u5c06\u4f1a\u8bb0\u5f55\u5f15\u64ce\u5185\u90e8\u6240\u6709\u7ec4\u4ef6\u76f8\u5173\u7684\u4fe1\u606f\uff0c\u9664\u975e\u67d0\u5185\u90e8\u7ec4\u4ef6\u5b9a\u4e49\u4e86\u81ea\u5df1\u7684Logger\u7ec4\u4ef6\u3002<\/p>\n

9\u3001\u9886\u57df(Realm)\uff1a\u7528\u4e8e\u7528\u6237\u7684\u8ba4\u8bc1\u548c\u6388\u6743\uff1b\u5728\u914d\u7f6e\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u7ba1\u7406\u5458\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u8d44\u6e90\u6216\u8d44\u6e90\u7ec4\u5b9a\u4e49\u89d2\u8272\u53ca\u6743\u9650\uff0c\u800c\u8fd9\u4e9b\u8bbf\u95ee\u63a7\u5236\u529f\u80fd\u7684\u751f\u6548\u9700\u8981\u901a\u8fc7Realm\u6765\u5b9e\u73b0\u3002Realm\u7684\u8ba4\u8bc1\u53ef\u4ee5\u57fa\u4e8e\u6587\u672c\u6587\u4ef6\u3001\u6570\u636e\u5e93\u8868\u3001LDAP\u670d\u52a1\u7b49\u6765\u5b9e\u73b0\u3002Realm\u7684\u6548\u7528\u4f1a\u904d\u53ca\u6574\u4e2a\u5f15\u64ce\u6216\u9876\u7ea7\u5bb9\u5668\uff0c\u56e0\u6b64\uff0c\u4e00\u4e2a\u5bb9\u5668\u5185\u7684\u6240\u6709\u5e94\u7528\u7a0b\u5e8f\u5c06\u5171\u4eab\u7528\u6237\u8d44\u6e90\u3002\u540c\u65f6\uff0cRealm\u53ef\u4ee5\u88ab\u5176\u6240\u5728\u7ec4\u4ef6\u7684\u5b50\u7ec4\u4ef6\u7ee7\u627f\uff0c\u4e5f\u53ef\u4ee5\u88ab\u5b50\u7ec4\u4ef6\u4e2d\u5b9a\u4e49\u7684Realm\u6240\u8986\u76d6\u3002<\/p>\n

\u5f15\u64ce(Engine)\uff1a\u5f15\u64ce\u662f\u6307\u5904\u7406\u8bf7\u6c42\u7684Servlet\u5f15\u64ce\u7ec4\u4ef6\uff0c\u5373Catalina Servlet\u5f15\u64ce\uff0c\u5b83\u4eceHTTPconnector\u63a5\u6536\u8bf7\u6c42\u5e76\u54cd\u5e94\u8bf7\u6c42\u3002\u5b83\u68c0\u67e5\u6bcf\u4e00\u4e2a\u8bf7\u6c42\u7684HTTP\u9996\u90e8\u4fe1\u606f\u4ee5\u8fa8\u522b\u6b64\u8bf7\u6c42\u5e94\u8be5\u53d1\u5f80\u54ea\u4e2ahost\u6216context\uff0c\u5e76\u5c06\u8bf7\u6c42\u5904\u7406\u540e\u7684\u7ed3\u679c\u8fd4\u56de\u7684\u76f8\u5e94\u7684\u5ba2\u6237\u7aef\u3002\u4e25\u683c\u610f\u4e49\u4e0a\u6765\u8bf4\uff0c\u5bb9\u5668\u4e0d\u5fc5\u975e\u5f97\u901a\u8fc7\u5f15\u64ce\u6765\u5b9e\u73b0\uff0c\u5b83\u4e5f\u53ef\u4ee5\u662f\u53ea\u662f\u4e00\u4e2a\u5bb9\u5668\u3002\u5982\u679cTomcat\u88ab\u914d\u7f6e\u6210\u4e3a\u72ec\u7acb\u670d\u52a1\u5668\uff0c\u9ed8\u8ba4\u5f15\u64ce\u5c31\u662f\u5df2\u7ecf\u5b9a\u4e49\u597d\u7684\u5f15\u64ce\u3002\u800c\u5982\u679cTomcat\u88ab\u914d\u7f6e\u4e3aApache Web\u670d\u52a1\u5668\u7684\u63d0\u4f9bServlet\u529f\u80fd\u7684\u540e\u7aef\uff0c\u9ed8\u8ba4\u5f15\u64ce\u5c06\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3aWeb\u670d\u52a1\u5668\u81ea\u8eab\u5c31\u80fd\u786e\u5b9a\u5c06\u7528\u6237\u8bf7\u6c42\u53d1\u5f80\u4f55\u5904\u3002\u4e00\u4e2a\u5f15\u64ce\u53ef\u4ee5\u5305\u542b\u591a\u4e2ahost\u7ec4\u4ef6\u3002<\/p>\n

Tomcat\u8fde\u63a5\u5668\u67b6\u6784<\/strong><\/span><\/div>\n

\u57fa\u4e8eApache\u505a\u4e3aTomcat\u524d\u7aef\u7684\u67b6\u6784\u6765\u8bb2\uff0cApache\u901a\u8fc7mod_jk\u3001mod_jk2\u6216mod_proxy\u6a21\u5757\u4e0e\u540e\u7aef\u7684Tomcat\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u3002\u800c\u5bf9Tomcat\u6765\u8bf4\uff0c\u6bcf\u4e2aWeb\u5bb9\u5668\u5b9e\u4f8b\u90fd\u6709\u4e00\u4e2aJava\u8bed\u8a00\u5f00\u53d1\u7684\u8fde\u63a5\u5668\u6a21\u5757\u7ec4\u4ef6\uff0c\u5728Tomcat6\u4e2d\uff0c\u8fd9\u4e2a\u8fde\u63a5\u5668\u662forg.apache.catalina.Connector\u7c7b\u3002\u8fd9\u4e2a\u7c7b\u7684\u6784\u9020\u5668\u53ef\u4ee5\u6784\u9020\u4e24\u79cd\u7c7b\u522b\u7684\u8fde\u63a5\u5668\uff1aHTTP\/1.1\u8d1f\u8d23\u54cd\u5e94\u57fa\u4e8eHTTP\/HTTPS\u534f\u8bae\u7684\u8bf7\u6c42\uff0cAJP\/1.3\u8d1f\u8d23\u54cd\u5e94\u57fa\u4e8eAJP\u7684\u8bf7\u6c42\u3002\u4f46\u53ef\u4ee5\u7b80\u5355\u5730\u901a\u8fc7\u5728server.xml\u914d\u7f6e\u6587\u4ef6\u4e2d\u5b9e\u73b0\u8fde\u63a5\u5668\u7684\u521b\u5efa\uff0c\u4f46\u521b\u5efa\u65f6\u6240\u4f7f\u7528\u7684\u7c7b\u6839\u636e\u7cfb\u7edf\u662f\u652f\u6301APR(Apache Portable Runtime)\u800c\u6709\u6240\u4e0d\u540c\u3002<\/p>\n

APR\u662f\u9644\u52a0\u5728\u63d0\u4f9b\u4e86\u901a\u7528\u548c\u6807\u51c6API\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u4e0a\u4e00\u4e2a\u901a\u8baf\u5c42\u7684\u672c\u5730\u5e93\u7684\u96c6\u5408\uff0c\u5b83\u80fd\u591f\u4e3a\u4f7f\u7528\u4e86APR\u7684\u5e94\u7528\u7a0b\u5e8f\u5728\u4e0eApache\u901a\u4fe1\u65f6\u63d0\u4f9b\u8f83\u597d\u4f38\u7f29\u80fd\u529b\u65f6\u5e26\u53bb\u5e73\u8861\u6548\u7528\u3002
\n\u540c\u65f6\uff0c\u9700\u8981\u8bf4\u660e\u7684\u662f\uff0cmod_jk2\u6a21\u5757\u76ee\u524d\u5df2\u7ecf\u4e0d\u518d\u88ab\u652f\u6301\u4e86\uff0cmod_jk\u6a21\u5757\u76ee\u524d\u8fd8apache\u88ab\u652f\u6301\uff0c\u4f46\u5176\u9879\u76ee\u6d3b\u8dc3\u5ea6\u5df2\u7ecf\u5927\u5927\u964d\u4f4e\u3002\u56e0\u6b64\uff0c\u76ee\u524d\u66f4\u5e38\u7528 \u7684\u65b9\u5f0f\u662f\u4f7f\u7528mod_proxy\u6a21\u5757\u3002<\/p>\n

\u5982\u679c\u652f\u6301APR\uff1a<\/p>\n

\t\r\nHTTP\/1.1\uff1aorg.apache.cotote.http11.Http11AprProtocol\r\nAJP\/1.3\uff1aorg.apache.coyote.ajp.AjpAprProtocol\r\n<\/pre>\n

\u5982\u679c\u4e0d\u652f\u6301APR\uff1a<\/p>\n

HTTP\/1.1: org.apache.coyote.http11.Http11Protocol\r\nAJP\/1.3: org.apache.jk.server.JkCoyoteHandler\r\n<\/pre>\n
\u8fde\u63a5\u5668\u534f\u8bae<\/strong><\/span><\/div>\n

Tomcat\u7684Web\u670d\u52a1\u5668\u8fde\u63a5\u5668\u652f\u6301\u4e24\u79cd\u534f\u8bae\uff1aAJP\u548cHTTP\uff0c\u5b83\u4eec\u5747\u5b9a\u4e49\u4e86\u4ee5\u4e8c\u8fdb\u5236\u683c\u5f0f\u5728Web\u670d\u52a1\u5668\u548cTomcat\u4e4b\u95f4\u8fdb\u884c\u6570\u636e\u4f20\u8f93\uff0c\u5e76\u63d0\u4f9b\u76f8\u5e94\u7684\u63a7\u5236\u547d\u4ee4\u3002<\/p>\n

AJP(Apache JServ Protocol)\u534f\u8bae\uff1a\u76ee\u524d\u6b63\u5728\u4f7f\u7528\u7684AJP\u534f\u8bae\u7684\u7248\u672c\u662f\u901a\u8fc7JK\u548cJK2\u8fde\u63a5\u5668\u63d0\u4f9b\u652f\u6301\u7684AJP13\uff0c\u5b83\u57fa\u4e8e\u4e8c\u8fdb\u5236\u7684\u683c\u5f0f\u5728Web\u670d\u52a1\u5668\u548cTomcat\u4e4b\u95f4\u4f20\u8f93\u6570\u636e\uff0c\u800c\u6b64\u524d\u7684\u7248\u672cAJP10\u548cAJP11\u5219\u4f7f\u7528\u6587\u672c\u683c\u5f0f\u4f20\u8f93\u6570\u636e\u3002<\/p>\n

HTTP\u534f\u8bae\uff1a\u8bda\u5982\u5176\u540d\u79f0\u6240\u8868\u793a\uff0c\u5176\u662f\u4f7f\u7528HTTP\u6216HTTPS\u534f\u8bae\u5728Web\u670d\u52a1\u5668\u548cTomcat\u4e4b\u95f4\u5efa\u7acb\u901a\u4fe1\uff0c\u6b64\u65f6\uff0cTomcat\u5c31\u662f\u4e00\u4e2a\u5b8c\u5168\u529f\u80fd\u7684HTTP\u670d\u52a1\u5668\uff0c\u5b83\u9700\u8981\u76d1\u542c\u5728\u67d0\u7aef\u53e3\u4e0a\u4ee5\u63a5\u6536\u6765\u81ea\u4e8e\u5546\u524d\u670d\u52a1\u5668\u7684\u8bf7\u6c42\u3002<\/p>\n

\u4e8c\u3001\u5b89\u88c5Tomcat<\/strong><\/div>\n

Tomcat\u7684\u5b98\u65b9\u7ad9\u70b9\u4e3ahttp:\/\/tomcat.apache.org\/<\/a>,\u8981\u5b89\u88c5Tomcat\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5JDK\u3002<\/p>\n

\u4ee5\u4e0b\u5b89\u88c5\u5e73\u53f0\u4e3aCentOS release 6.6 (Final) 32\u4f4d\u5e73\u53f0\u4e0a\uff0cJDK \u7248\u672c\u4e3ajdk-6u45-linux<\/a>-i586-rpm.bin \uff0ctomcat \u4f7f\u7528 apache-tomcat-7.0.63.tar.gz\u3002<\/p>\n

[root@localhost tomcat]# ls -l\r\ntotal 75676\r\n-rw-r--r--. 1 root root  8850470 Aug 12 02:08 apache-tomcat-7.0.63.tar.gz\r\n-rw-r--r--. 1 root root 68637258 Apr  6  2014 jdk-6u45-linux-i586-rpm.bin\r\n[root@localhost tomcat]# chmod +x jdk-6u45-linux-i586-rpm.bin \r\n[root@localhost tomcat]# .\/jdk-6u45-linux-i586-rpm.bin \r\n[root@localhost tomcat]# tar xf  apache-tomcat-7.0.63.tar.gz -C  \/usr\/local\/\r\n[root@localhost tomcat]# ln -s \/usr\/local\/apache-tomcat-7.0.63\/  \/usr\/local\/tomcat\r\n[root@node1 tomcat]# vim \/etc\/profile.d\/java.sh     #\u8bbe\u7f6ejava\u73af\u5883\u53d8\u91cf\r\nexport JAVA_HOME=\/usr\/java\/latest\r\nexport PATH=$PATH:$JAVA_HOME\/bin\r\n[root@node1 conf]# .  \/etc\/profile.d\/tomcat.sh\r\n[root@node1 tomcat]# vim \/etc\/profile.d\/tomcat.sh       #\u8bbe\u7f6etomcat\u73af\u5883\u53d8\u91cf\r\nexport CATALINA_HOME=\/usr\/local\/tomcat\r\nexport PATH=$PATH:$CATALINA_HOME\/bin\r\n[root@node1 conf]# catalina.sh version    \r\nUsing CATALINA_BASE:   \/usr\/local\/tomcat\r\nUsing CATALINA_HOME:   \/usr\/local\/tomcat\r\nUsing CATALINA_TMPDIR: \/usr\/local\/tomcat\/temp\r\nUsing JRE_HOME:        \/usr\/java\/jdk1.6.0_45\r\nUsing CLASSPATH:       \/usr\/local\/tomcat\/bin\/bootstrap.jar:\/usr\/local\/tomcat\/bin\/tomcat-juli.jar\r\nServer version: Apache Tomcat\/7.0.63\r\nServer built:   Jun 30 2015 08:08:33 UTC\r\nServer number:  7.0.63.0\r\nOS Name:        Linux\r\nOS Version:     2.6.32-504.el6.i686\r\nArchitecture:   i386\r\nJVM Version:    1.6.0_45-b06\r\nJVM Vendor:     Sun Microsystems Inc.\r\n[root@localhost tomcat]# vim \/etc\/init.d\/tomcat    #\u63d0\u4f9b\u542f\u52a8\u811a\u672c\r\n#!\/bin\/sh\r\n# Tomcat init script for Linux.\r\n#\r\n# chkconfig: 2345 96 14\r\n# description: The Apache Tomcat servlet\/JSP container.\r\n# JAVA_OPTS='-Xms64m -Xmx128m'\r\nJAVA_HOME=\/usr\/java\/latest\r\nCATALINA_HOME=\/usr\/local\/tomcat\r\nexport JAVA_HOME CATALINA_HOME\r\ncase $1 in\r\nstart)\r\n  exec $CATALINA_HOME\/bin\/catalina.sh start ;;\r\nstop)\r\n  exec $CATALINA_HOME\/bin\/catalina.sh stop;;\r\nrestart)\r\n  $CATALINA_HOME\/bin\/catalina.sh stop\r\n  sleep 2\r\n  exec $CATALINA_HOME\/bin\/catalina.sh start ;;\r\nconfigtest)\r\n  exec $CATALINA_HOME\/bin\/catalina.sh configtest ;;\r\n*)\r\n  exec $CATALINA_HOME\/bin\/catalina.sh * ;;\r\nesac\r\n[root@localhost tomcat]# chmod +x  \/etc\/init.d\/tomcat \r\n[root@localhost tomcat]# chkconfig --add tomcat\r\n[root@node1 tomcat]# catalina.sh start\r\n[root@node1 tomcat]# jps      #\u663e\u793aBootstrap\u542f\u52a8\u5219\u8868\u793a\u542f\u52a8\u6210\u529f\r\n29145 Bootstrap                           \r\n29163 Jps\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

Tomcat \u670d\u52a1\u5668\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u653e\u6e90\u4ee3\u7801\u7684Web \u5e94\u7528\u670d\u52a1\u5668\uff0cTomcat\u662fApache \u8f6f\u4ef6\u57fa\u91d1\u4f1a\uff08Apa […]<\/p>\n","protected":false},"author":1476,"featured_media":156324,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-156264","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\/156264","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\/1476"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=156264"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156264\/revisions"}],"predecessor-version":[{"id":156414,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156264\/revisions\/156414"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/156324"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=156264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=156264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=156264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}