{"id":2400,"date":"2013-11-28T15:00:36","date_gmt":"2013-11-28T06:00:36","guid":{"rendered":"https:\/\/www.united-bears.co.jp\/blog\/?p=2400"},"modified":"2013-11-27T17:27:44","modified_gmt":"2013-11-27T08:27:44","slug":"apache-2-2-x-%e3%81%a8-tomcat-%e3%81%ae%e9%80%a3%e6%90%ba2-%ef%bd%9e%e3%83%99%e3%83%bc%e3%82%b7%e3%83%83%e3%82%af%e8%aa%8d%e8%a8%bc%e3%81%ae%e7%b6%99%e6%89%bf%ef%bd%9e","status":"publish","type":"post","link":"https:\/\/www.united-bears.co.jp\/blog\/archives\/2400","title":{"rendered":"Apache 2.2.x \u3068 Tomcat \u306e\u9023\u643a(2) \uff5e\u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u306e\u7d99\u627f\uff5e"},"content":{"rendered":"<p>\u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u3084 IP \u30a2\u30c9\u30ec\u30b9\u306b\u3088\u308b\u8a8d\u8a3c\u3092\u884c\u3046\u30b3\u30fc\u30c9\u306f\u3001\u307b\u3068\u3093\u3069\u66f8\u304d\u76f4\u3059\u3053\u3068\u304c\u306a\u3044\u3002\u3044\u3056\u30b3\u30fc\u30c9\u3092\u66f8\u3053\u3046\u3068\u3057\u305f\u3089\u5fd8\u308c\u3066\u3057\u307e\u3063\u3066\u3044\u305f\u3068\u3044\u3046\u3053\u3068\u304c\u306a\u3044\u3088\u3046\u306b\u3001Apache 2.2.x \u3068 Tomcat 6.0.x\/Tomcat 7.0.x \u3092\u9023\u643a\u3057\u3001Apche \u304c\u53d6\u5f97\u3059\u308b\u60c5\u5831\u3092 Tomcat \u3067\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u30e1\u30e2\u3068\u3057\u3066\u6b8b\u3057\u3066\u304a\u304f\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<h2>Apache \u3068 Tomcat \u306e\u9023\u643a\u65b9\u6cd5<\/h2>\n<p>HTTP \u30d7\u30ed\u30ad\u30b7\u30fc\u3067\u3042\u308b mod_proxy_http \u3092\u4f7f\u3046\u65b9\u6cd5\u3068\u3001AJP \u3067\u63a5\u7d9a\u3059\u308b mod_proxy_ajp \u3092\u4f7f\u3046\u65b9\u6cd5\u304c\u3042\u308b\u3002\u7d50\u8ad6\u304b\u3089\u8ff0\u3079\u308b\u3068\u3001<\/p>\n<ul>\n<li>Apache \u3068 Tomcat \u306f AJP \u3067\u9023\u643a\u3059\u308b<\/li>\n<li>Tomcat \u306e Connector \u306e\u8a2d\u5b9a\u3067 tomcatAuthentication \u3092 false \u306b\u8a2d\u5b9a\u3059\u308b(&lt;Connector port=&#8221;8009&#8243; protocol=&#8221;AJP\/1.3&#8243; redirectPort=&#8221;8443&#8243; tomcatAuthentication=&#8221;false&#8221;\/&gt;)<\/li>\n<\/ul>\n<p>\u306e2\u3064\u304c\u5fc5\u8981\u3060\u3002\u305d\u308c\u305e\u308c\u691c\u8a3c\u3057\u3066\u307f\u305f\u7d50\u679c\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3060\u3002<\/p>\n<h3>mod_proxy_http \u3092\u4f7f\u7528\u3057\u305f\u5834\u5408<\/h3>\n<p>Apache \u306e\u8a2d\u5b9a\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3060\u3002<\/p>\n<pre>\r\nProxyPass \/app http:\/\/192.168.1.2:8080\/app\r\n<\/pre>\n<p>Tomcat \u3067\u52d5\u4f5c\u3059\u308b Java \u306e\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre>\r\nHttpServletRequest request; \/\/ \u3069\u3053\u304b\u304b\u3089\u6e21\u3055\u308c\u305f request\r\nSystem.err.println(request.getRemoteHost()); \/\/ 192.168.1.1 &lt;= Apache \u306e IP \u30a2\u30c9\u30ec\u30b9\r\nSystem.err.println(request.getRemoteUser()); \/\/ null\r\n<\/pre>\n<p>mod_proxy_http \u3092\u5229\u7528\u3057\u305f\u5834\u5408\u3001HTTP \u30d7\u30ed\u30ad\u30b7\u30fc\u63a5\u7d9a\u306b\u306a\u308b\u305f\u3081\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e IP \u30a2\u30c9\u30ec\u30b9\u306f Apache \u306e IP \u30a2\u30c9\u30ec\u30b9\u306b\u306a\u308a\u3001\u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u306e\u30e6\u30fc\u30b6\u30fc\u3082\u53d6\u5f97\u3067\u304d\u306a\u3044\u3002<\/p>\n<h3>mod_proxy_ajp \u3092\u4f7f\u7528\u3057\u305f\u5834\u5408(1)<\/h3>\n<p>Tomcat \u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3067\u3001Apache \u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305f\u3002<\/p>\n<pre>\r\nProxyPass \/app ajp:\/\/192.168.1.2:8009\/app\r\n<\/pre>\n<p>Tomcat \u3067\u52d5\u4f5c\u3059\u308b Java \u306e\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre>\r\nHttpServletRequest request; \/\/ \u3069\u3053\u304b\u304b\u3089\u6e21\u3055\u308c\u305f request\r\nSystem.err.println(request.getRemoteHost()); \/\/ 192.168.1.100 &lt;= \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e IP \u30a2\u30c9\u30ec\u30b9\r\nSystem.err.println(request.getRemoteUser()); \/\/ null\r\n<\/pre>\n<p>AJP \u3067\u63a5\u7d9a\u3057\u305f\u5834\u5408\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e IP \u30a2\u30c9\u30ec\u30b9\u306f\u6b63\u3057\u304f\u53d6\u5f97\u3067\u304d\u308b\u3002\u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u306e\u30e6\u30fc\u30b6\u30fc\u306f\u3001Tomcat \u5074\u306e\u8a2d\u5b9a\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u307e\u307e\u3067\u306f\u53d6\u5f97\u3067\u304d\u305a null \u306b\u306a\u308b\u3002<\/p>\n<h3>mod_proxy_ajp \u3092\u4f7f\u7528\u3057\u305f\u5834\u5408(2)<\/h3>\n<p>Tomcat \u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb server.xml \u306e Connector \u306e\u30a2\u30c8\u30ea\u30d3\u30e5\u30fc\u30c8\u306b\u3001\u300ctomcatAuthentication\u300d\u304c\u3042\u308b\u3002<a href=\"http:\/\/tomcat.apache.org\/tomcat-6.0-doc\/config\/ajp.html\" target=\"_blank\">Tomcat 6\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u8aad\u3080\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\u3042\u308b\u3002<\/p>\n<blockquote><p>\nIf set to true, the authentication will be done in Tomcat. Otherwise, the authenticated principal will be propagated from the native webserver and used for authorization in Tomcat. The default value is true.\n<\/p><\/blockquote>\n<p>\u8a8d\u8a3c\u3092 Tomcat \u3067\u884c\u3046\u5834\u5408\u306f true \u306b\u3001Web Server \u304b\u3089\u5f15\u304d\u7d99\u3044\u3067\u5229\u7528\u3059\u308b\u5834\u5408\u306f false \u306b\u8a2d\u5b9a\u3059\u308c\u3070\u3088\u3044\u306e\u3060\u304c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u304c true \u306a\u306e\u3067\u81ea\u5206\u3067\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002server.xml \u306e AJP \u306e\u30b3\u30cd\u30af\u30bf\u30fc\u306b\u3001tomcatAuthentication \u306e\u30a2\u30c8\u30ea\u30d3\u30e5\u30fc\u30c8\u3092\u52a0\u3048\u308b\u3002<\/p>\n<pre>\r\n&lt;Connector port=\"8009\" protocol=\"AJP\/1.3\" redirectPort=\"8443\" tomcatAuthentication=\"false\"\/&gt;<\/pre>\n<p>Apache \u306e\u8a2d\u5b9a\u306f\u3001(1)\u306e\u5834\u5408\u3068\u540c\u3058\u3060\u3002<\/p>\n<pre>\r\nProxyPass \/app ajp:\/\/192.168.1.2:8009\/app\r\n<\/pre>\n<p>Tomcat \u3067\u52d5\u4f5c\u3059\u308b Java \u306e\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre>\r\nHttpServletRequest request; \/\/ \u3069\u3053\u304b\u304b\u3089\u6e21\u3055\u308c\u305f request\r\nSystem.err.println(request.getRemoteHost()); \/\/ 192.168.1.100 &lt;= \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e IP \u30a2\u30c9\u30ec\u30b9\r\nSystem.err.println(request.getRemoteUser()); \/\/ user\r\n<\/pre>\n<p>AJP \u3067\u63a5\u7d9a\u3057\u3066 tomcatAuthentication \u3092 false \u306b\u3059\u308c\u3070\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e IP \u30a2\u30c9\u30ec\u30b9\u3082\u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u306e\u30e6\u30fc\u30b6\u30fc\u3082 Tomcat \u5074\u306e\u30b3\u30fc\u30c9\u3067\u53d6\u5f97\u3067\u304d\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u3084 IP \u30a2\u30c9\u30ec\u30b9\u306b\u3088\u308b\u8a8d\u8a3c\u3092\u884c\u3046\u30b3\u30fc\u30c9\u306f\u3001\u307b\u3068\u3093\u3069\u66f8\u304d\u76f4\u3059\u3053\u3068\u304c\u306a\u3044\u3002\u3044\u3056\u30b3\u30fc\u30c9\u3092\u66f8\u3053\u3046\u3068\u3057\u305f\u3089\u5fd8\u308c\u3066\u3057\u307e\u3063\u3066\u3044\u305f\u3068\u3044\u3046\u3053\u3068\u304c\u306a\u3044\u3088\u3046\u306b\u3001Apache 2.2.x \u3068 Tomcat 6.0.x\/Tomca [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-2400","post","type-post","status-publish","format-standard","hentry","category-server"],"_links":{"self":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/2400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=2400"}],"version-history":[{"count":5,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/2400\/revisions"}],"predecessor-version":[{"id":2405,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/2400\/revisions\/2405"}],"wp:attachment":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=2400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=2400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=2400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}