Hi Edwin: On 6/11/2016 9:43 AM, Edwin Quijada wrote: > Hi! I am trying to put Apache in front of Tomcat , DEbian Jessie but > it become a titanic work without success. I read all info about this > and seems it is easy but doesnt work. > > > I am using APache 2.4+ Jessie +Tomcat 8.035 , I use this tuto > http://www.zeitoun.net/articles/configure-mod_proxy_ajp-with-tomcat/start > > How to configure mod_proxy_ajp with Tomcat - > Zeitoun<http://www.zeitoun.net/articles/configure-mod_proxy_ajp-with-tomcat/start> > > www.zeitoun.net > mod_proxy_ajp is an Apache module which can be used to forward a > client HTTP request to an internal Tomcat application server using > the AJP protocol. > > but doesnt work , I seek others sources and all has the same info but > I cant work for me > > > When I go myserver.com I get an error "Server Not Found" when I go to > the logs catalina.out and error.log for apache doesnt say anything > > > This is my 000-default.conf > > > <VirtualHost *:80> ServerAdmin webmaster@localhost > #DocumentRoot /var/www/html > > ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined > > <Proxy *> > AddDefaultCharset Off > Order deny,allow Allow from all > </Proxy> > > # this will pass all the requests from httpd to tomcat8 ProxyPass / > ajp://localhost:8009/fortunamovil ProxyPassReverse / > ajp://localhost:8009/fortunamovil </VirtualHost> > > > I have installed AJP modules for Apache and everything but really I > dont know to do > > > > I activate the coneecto AJP in the server.xml > > > Please, any cluees , help because this is make me crazy!! > > There are lots of things going on here, and I'll just mention a few. 1. "Server Not Found" This has nothing to do with Apache HTTPD or Apache Tomcat and everything to do with DNS. How do you access your Debian Jessie system? If you do this on the local host, then you could access it via http://localhost/ in the browser. If you do this from a remote machine, then you are probably accessing it via http://myserver.com/ in the browser. If myserver.com is not resolvable via DNS to an IP address, then you'll get the error that you reported. The easiest way to fix that is to edit the hosts file (/etc/hosts on Linux, %WINDIR%\System32\drivers\etc on Windows 7) and add the following line: ip.address myserver.com where ip.address is the address of the machine, for example 192.168.0.250. 2. proxying I know a lot of people who favor mod_proxy_ajp over mod_ajp or mod_proxy_http. I personally prefer mod_ajp, but many people find it a bit more confusing. Anyway, I'm not an expert on mod_proxy family, but I'll try to make some comments. a. Don't change contexts That means if your WAR file is called fortunamovil.war, don't proxy it as /. If you want your application to be the default application for the Apache HTTPD / Apache Tomcat server, rename your war file to ROOT.war (case is important). There are a lot of edge cases where things don't quite work out as planned when you proxy cross-context. People get strange 404 errors, and usually have to fiddle with cookies, return paths, and making sure that nothing in the code returns the fully qualified URL. b. proxy statement This is rather scary: <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> This is an open proxy, so it is best to make sure your applications are secure (or limit your proxy). At least add ProxyRequests Off to your configuration. This will prevent your server from serving as forward proxy server. It does NOT impact the ProxyPass directives. c. ProxyPass If you follow item 'a' above, then you won't need a ProxyPassReverse statement. Just the following should do: ProxyPass "/app" "ajp://localhost:8009/app" In general, I find it nicer to proxy each individual application rather than the following: ProxyPass "/" "ajp://localhost:8009/" This sends everything to Tomcat. One of the reasons to run Apache HTTPD in front of Apache Tomcat is to allow Apache HTTPD to serve PHP / Python / Ruby / Perl applications. The above line proxies everything to Tomcat, which would prevent Apache HTTPD from serving anything. d. To proxy or not to proxy If you're not ever going to use Apache HTTPD as a web server (SSL, non-Java web applications, mod_security, some authorization tools such as SiteMinder), then there's no reason to run Apache HTTPD at all. Modify your HTTP connector to run on 80 (and another for 443 if you're using SSL), and use one of the many documented ways of running Apache Tomcat on port 80 as a non-root user. I'm sure Debian Jessie has those tools available. Here is a link to using commons-daemon: https://tomcat.apache.org/tomcat-8.0-doc/setup.html#Unix_daemon Hope this helps. . . . just my two cents /mde/
signature.asc
Description: OpenPGP digital signature