Override HTTP 500 Internal Server Error in Apache - apache

I am following the article Custom error pages in Apache for JBoss AS7 to configure apache to override HTTP 500 Internal Server Error. I am facing below problem, any guess what's the issue?
In #2 in the above linked article
# (4) Setting error code 404 for "MyApp" application
JkMount /MyApp/* nodeA;use_server_errors=404
In windows env it works where it points to jboss directly
JkMount /MyApp/* jboss7;use_server_errors=500
But in linux where it points to load balancer
JkMount /MyApp/* loadbalancer2;use_server_errors=500
This gives me error:
jk_handler::mod_jk.c (2372): Could not find a worker for worker name=loadbalancer2;use_server_errors=500
Windows apache version is 2.2.17, linux apache version is 2.5.1.

I found out the problem, it is due to the older version of mod_jk. The flag 'use_server_errors' was introduced in mod_jk 1.2.27. In my case linux Apache 2.5.1 has mod_jk 1.2.26 that's why it reads 'loadbalancer2;use_server_errors=500' as a whole. It works in windows because there Apache 2.2.17 has mod_jk 1.2.28 which knows to separate the flag from worker name.

Related

302 redirect, Tomcat behind Apache for hybris

I've configured hybris and apache,mod_jk using below blog article.
www.facebook.com/permalink.php?id=317609748375071&story_fbid=680730588729650
hybris is completely running fine on tomcat ports http on 9001 and https on 9002.
one of developer has also configured redirection at hybris level
so any request comes in for http://hot.local:9001/ it gets automatically
redirect to https://hot.local:9002/abc/en.
Now I'm stuck at apache and mod_jk configuration point of view.
I'm not able to setup URL redirection in apache with mod_jk configuration.
Getting below error
[22993:22208] [debug] jk_handler::mod_jk.c
(2047): Service finished with status=302 for worker=tss1
I'm configuring above stuff on UBUNTU.
1) Opened Port 443 exclusively in ubuntu
2) Include redirectPort="8443" in tomcat siemap.xml
3) Include below tag in apache2 ssl config
JkMountCopy On

How to configure tomcat and apache

I have to configure Apache httpd server with Tomcat. I have followed this tutorial and I am getting this error
D:\myproject\apache\bin>httpd -k start
httpd: Syntax error on line 560 of D:/myproject/apache/conf/httpd.conf: Syntax e
rror on line 3 of D:/myproject/tomcat/conf/mod_jk.conf: Cannot load D:/myproject
/apache/modules/mod_jk.so into server: The specified procedure could not be foun
d.
I couldn't sort out first, that I was getting version error. Most probably I am trying to insert 32 bit mod_jk to 64 bit OS. If any one have well-configured Apache httpd server and tomcat please share it.
mod_jk obliges two substances:
mod_jk.xxx - The Apache HTTP Server module, contingent upon your working framework, it will be mod_jk.so, mod_jk.nlm or MOD_JK.SRVPGM (see the fabricate segment).
workers.properties - A record that portrays the host(s) and port(s) utilized by the specialists (Tomcat forms). A specimen workers.properties can be found under the conf registry in the source download.
Additionally as with other Apache HTTP Server modules, mod_jk ought to be initially introduced on the modules catalog of your Apache webserver, ie :/usr/lib/apache and you ought to overhaul your httpd.conf record. For More Visit http://www.pillenpalast.com/

Configuring Apache on top of GF3 - Not working

I'm trying to configure Apache on top of Glassfish v3 using apj13.
But when I'm trying to access http://<server_name>/myApp but this is not working. It is keep on loading the page.
From Glassfish side I've not made any changes.
From Apache side I've edited the httpd.conf file to include virtual server using
JkMount /myApp/* worker1
There was no helpful logs in either from Glassfish or Apache.
Update:
Worker.properties file
worker.worker1.port=28081
worker.worker1.host=myservername
worker.worker1.type=ajp13
The application is using Primefaces if that helps.
Any help is much appreciated.!
Thanks.
I found the solution for this.
I was having wrong configuration (incorrect port) in my worker.properties file. Below is the correct one (for me)
worker.worker1.port=8009 //the port was wrong. Instead of having APJ port I had HTTP port
worker.worker1.host=myservername
worker.worker1.type=ajp13
Also I had included socket_connect_timeout to the properties file to check for any errors while communicating with JK and remote host.
Please note that I also had cluster enabled in my GF and I had to manually configured different APJ_LISTENER_PORT value in custer configuration page in Admin Console of GF.
Hope this might help someone.!

HHVM through Apache mod_fastcgi on debian

I've been able to rather easily get facebooks hhvm working from prebuilt debian packages as well as compile it, and afterwards to run it behind apache as a proxy. The problem with the proxy setup is though, that I can't get response headers other than http status code 200 - like 304 for example - through. It's not the proxy config of apache, but something wrt hhvm and apache interact, or even in hhvm.
Anyway, HHVM officially stopped supporting the standalone server, and they're moving over to fastcgi, and as all of our servers are running Debian, I don't have access to mod_proxy_fastcgi without compiling it (the only backports I found of apache 2.4 don't have mod_proxy_fastcgi backported unfortunately).
So I'm currently trying to get HHVM to run behind the old mod_fastcgi with apache 2.2. But currently I'm only getting "connect() failed" in the error log of apache, while hhvm is listening on :::1080
The important part of my apache config is
RemoveHandler application/x-httpd-php
FastCgiExternalServer /home/www/hhvm/hostname/htdocs/php5.fcgi -flush -host ip6-localhost:1080
AddType application/x-hhtpd-fastphp5 .php
Action application/x-httpd-fastphp5 /php5.fcgi
Alias /php5.fcgi /home/www/hhvm/hostname/htdocs/php5.fcgi
netstat also lists hhvm as listening on :::1080 and I can connect to it via telnet
Any Ideas on what I need to change so it works?
Looks like a IP6 port problem. Try \[ip6-localhost\]:1080 . Not sure if this has side effects in Apache.
How do ports work with IPv6?

Apache & JBoss use port 80 at the same time

I have both Apache 2 and JBoss 4.2.3 on the same machine and would like both of them to use port 80. There are several ways I see people doing this mod_jk, mod_proxy, but I'm not sure which one is the best.
I don't need any load balancing, but I do need HTTPS.
You can't have two applications listening to the same tcp port (80) at the same time. You can use mod_jk to have http requests on port 80 routed from Apache server to the JBoss server. This is the method I am most familiar with and prefer. mod_proxy should also work, but I find that method a little more complicated.
Configuring https on Apache is probably best dealt with as a separate topic. There are issues with purchasing a ssl certificate, creating a self-signed certificate, etc.
There are two steps to accomplish configure mod_jk to route requests from the Apache server to the JBoss server:
Configure the Apache web server to forward some requests to the JBoss server.
The Apache configuration will vary depending on the distribution of Apache that you are using (windows, RHEL, debian, built from source, etc.) but the concepts should be similar for any Apache installation.
You need to download mod_jk for your platform from the tomcat web site:
http://tomcat.apache.org/download-connectors.cgi
Your OS vendor may provide a binary for you, so check there first. You may also compile mod_jk yourself if you prefer.
Copy the mod_jk binary (mod_jk.so for Linux/UNIX system, not sure about windows) into your Apache servers modules directory (this depends on the Apache distribution you are using).
Add the equivalent directive to your Apache configuration:
LoadModule jk\_module /usr/lib/apache2/modules/mod\_jk.so
You should add two configuration files to the Apache configuration directory: mod_jk.conf and workers.properties. You should include mod_jk.conf from the main Apache configuration file:
Include /etc/apache2/mod\_jk.conf
The workers.properties file is included by mod_jk.conf with the JkWorkersFile directive.
More detailed settings for mod_jk.conf can be found at the tomcat documentation page:
http://tomcat.apache.org/connectors-doc/reference/apache.html
The important directives are:
JkWorkersFile (specifies where the workers.properties file lives)
JkMount (mount point for mapping of URI to tomcat worker)
An example:
JkWorkersFile /etc/apache2/workers.properties<br>
JkMount /examples/* myworker<br>
JkMount /examples myworker
These directives map the /examples and /examples/ URI to the myworker tomcat worker.
Conceptually you can think of a worker as representing a tomcat or JBoss instance and the mount as a way of mapping a URI to a worker. This way of representing things allows one Apache server to be the front end for several tomcat or JBoss servers. This can be handy if you have only one IP address you can use but wish to run several application servers behind one Apache server.
The workers.properties files describes the tomcat or JBoss server(s) that the Apache server will connect to. Important entries in this file are:
worker.list=myworker<br>
worker.tomcat.type=ajp13<br>
worker.tomcat.host=localhost<br>
worker.tomcat.port=8009
There are other worker properties that can be found in the tomcat documentation page for the workers.properties file:
http://tomcat.apache.org/connectors-doc/reference/workers.html
Configure the JBoss server to accept connections from the Apache server
The JBoss server is configured to accept mod_jk connections on port 8009 (the default ajp port) out of the box, but it is good to know where to configure this in case you want to change any of this in the future.
The configuration is in the tomcat based portion of the JBoss server located in ${JBOSS_SERVER_CONFIGURATION}/deploy/jbossweb.sar/server.xml. This is for JBoss AS 5.1.0.GA, previous versions are in a similar location. The mod_jk connector is configured in the Connector section for the AJP 1.3 protocol and looks like:
<Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443" />
The most common reason to modify this section is if you have multiple tomcat or JBoss servers connecting to apache via the AJP protocol, you can adjust the port number that the AJP connector will listens on so there are no conflicts.