﻿{"id":392,"date":"2016-06-01T22:50:39","date_gmt":"2016-06-01T14:50:39","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=392"},"modified":"2016-06-01T22:50:39","modified_gmt":"2016-06-01T14:50:39","slug":"redirect-apache-to-tomcat-8-with-mod-proxy","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=392","title":{"rendered":"Redirect apache to tomcat 8 with mod proxy"},"content":{"rendered":"<p>I&#8217;m trying to redirect Apache Webserver to Tomcat 8 in Ubuntu. Both of them are working properly but I can&#8217;t redirect from port 80 in Apache to Tomcat in 8080. My apps work un <a href=\"http:\/\/localhost:8080\/cms\" rel=\"nofollow\">http:\/\/localhost:8080\/cms<\/a>and myapp. I followed <a href=\"https:\/\/tomcat.apache.org\/tomcat-8.0-doc\/proxy-howto.html\" rel=\"nofollow\">this<\/a>. I tried also AJP mod but it didn&#8217;t work. I used a2enmod: <code>a2enmod proxy<\/code>and <code>a2enmod proxy_http<\/code> to enable modules.<\/p>\n<p>This is my apache2\/sites-available\/000-default.conf.<\/p>\n<pre class=\"lang:default decode:true\">&lt;VirtualHost *:80&gt;\r\nProxyRequests off\r\nProxyPreserveHost on\r\n\r\nServerAdmin webmaster@localhost\r\nDocumentRoot \/var\/www\/html\r\n\r\nErrorLog ${APACHE_LOG_DIR}\/error.log\r\nCustomLog ${APACHE_LOG_DIR}\/access.log combined\r\n\r\nProxyPass         \/myapp  http:\/\/localhost:8082\/myapp\r\nProxyPassReverse  \/myapp  http:\/\/localhost:8082\/myapp\r\n\r\nProxyPass         \/cms  http:\/\/localhost:8082\/cms\r\nProxyPassReverse  \/cms  http:\/\/localhost:8082\/cms\r\n\r\n&lt;\/VirtualHost&gt;<\/pre>\n<p>These are my servlet.xml connectors:<\/p>\n<pre class=\"lang:default decode:true \">   &lt;Connector port=\"8080\" protocol=\"HTTP\/1.1\"\r\n               connectionTimeout=\"20000\"\r\n               redirectPort=\"8443\" \/&gt;\r\n    &lt;Connector port=\"8082\" proxyPort=\"80\"\/&gt;\r\n    &lt;Connector port=\"8009\" redirectPort=\"8443\" protocol=\"AJP\/1.3\"\/&gt;<\/pre>\n<p>Using <code>ProxyPass \/cms http:\/\/localhost:8080\/<\/code>cms don&#8217;t work either.<\/p>\n<p>Thanks in advance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to redirect Apache Webserver to Tomcat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[239],"class_list":["post-392","post","type-post","status-publish","format-standard","hentry","category-tomcat","tag-tomcat"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=392"}],"version-history":[{"count":1,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":393,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions\/393"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}