mod_jk status page not working - linux

I am doing clustering in Tomcat 7 with Apache server. It is working fine too. However I have the following issues:
1) I am trying to monitor the mod_jk status page; but it is giving 404 error.
2) in Log following error is shown -
[Tue Dec 17 13:16:51.019 2013] [2236:140599476504544] [error] init_jk::mod_jk.c (3348): Initializing shm:/etc/httpd/logs/mod_jk.shm.2236 errno=13. Load balancing workers will not function properly.
[Tue Dec 17 13:16:51.019 2013] [2236:140599476504544] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Tue Dec 17 13:16:51.041 2013] [2237:140599476504544] [error] init_jk::mod_jk.c (3348): Initializing shm:/etc/httpd/logs/mod_jk.shm.2237 errno=13. Load balancing workers will not function properly.
[Tue Dec 17 13:16:51.042 2013] [2237:140599476504544] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
Here is worker.properties file
worker.list=tomcatnode1,tomcatnode2,loadbalancer,statusmanager
worker.tomcatnode1.port=8009
worker.tomcatnode1.host=localhost
worker.tomcatnode1.type=ajp13
worker.tomcatnode1.lbfactor=100
worker.tomcatnode2.port=8010
worker.tomcatnode2.host=localhost
worker.tomcatnode2.type=ajp13
worker.tomcatnode2.lbfactor=100
#Load Balance Configuration
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcatnode1, tomcatnode2
worker.loadbalancer.sticky_session=1
#worker.list=jkstatus
worker.statusmanager.type=status
Here is mod_jk.conf file
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkShmFile logs/mod_jk.shm
JkMount /IntellixWebApi/* loadbalancer
#JkMount /jkmanager/* jkstatus
#JkMount /jkmanager jkstatus
<Location /status/>
JkMount statusmanager
Order deny,allow
# Deny from all
Allow from 127.0.0.1
</Location>
If I am accessing IntellixWebApi; it is accessable. but When I am using /status; it is not working.
Please suggest.
Thanks

After lots of googling; I am able to get the jk_manager status screen. Firstly I have disable the SELINUX and then after restarting the system; I set the following JkMount
JkMount /* loadbalancer
JkMount /IntellixWebApi/* loadbalancer
JkMount /jkmanager/* jkstatus
<Location /status/>
JkMount statusmanager
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
This worked for me.
Thanks

Related

Intermittent Service not available Error in Elasticbeanstalk application

We are using a webserver with ElasticBeanstalk from 2019.,
the platform is
tomcat 8.5 with java8 running on 64 bit Amazon Linux. httpd as proxy
recently (from Jan 30th) we started getting Service Unavailable issues if go to the endpoint from time to time. and if we refresh 2-3 times it will get resolved on its own.
then I download full logs. under elasticbeanstalk-error_log I can see
[Mon Feb 28 10:00:58.338035 2022] [proxy:error] [pid 14882:tid 139757313533696] (13)Permission denied: AH02454: HTTP: attempt to connect to Unix domain socket /var/run/httpd/ (localhost) failed
[Mon Feb 28 10:00:58.338078 2022] [proxy_http:error] [pid 14882:tid 139757313533696] [client <private-ip-here>:12566] AH01114: HTTP: failed to make connection to backend: httpd-UDS, referer: http://<custom-end-point>/1/<name.jsp>?s=sec$$4P!&refresh=300
[Mon Feb 28 10:43:40.663468 2022] [proxy:error] [pid 14882:tid 139757120071424] (13)Permission denied: AH02454: HTTP: attempt to connect to Unix domain socket /var/run/httpd/ (localhost) failed
[Mon Feb 28 10:43:40.663518 2022] [proxy_http:error] [pid 14882:tid 139757120071424] [client <private-ip-here>:21136] AH01114: HTTP: failed to make connection to backend: httpd-UDS
repeated multiple times from Jan30th.
and when I look at access.log
I can see 503 error log exactly at the same time when permission denied error logs in elasticbeanstalk-error_log
And I looked at the running process using ps -aux | grep HTTPd and ps -aux | grep tomcat
both are running from 2019 and have no restarts.
what more I can do to troubleshoot these issuesWe are running a web application written in Java(tomcat8) hosted in AWS ElastcBeanStalk
Some weeks back we started getting 503 error randomly
When we checked the elasticbeanstalk-erorr_logs
[Thu Mar 03 13:22:12.906144 2022] [proxy:error] [pid 14882:tid 139757338711808] (13)Permission denied: AH02454: HTTP: attempt to connect to Unix domain socket /var/run/httpd/ (localhost) failed
[Thu Mar 03 13:22:12.906202 2022] [proxy_http:error] [pid 14882:tid 139757338711808] [client 172.31.17.0:61382] AH01114: HTTP: failed to make connection to backend: httpd-UDS, referer: http://our-domain.com/1/callBackLog.jsp
The error logs are suggesting connection error with backend unix socket
When we checked in /var/run/httpd/ folder, there were no unix sockets(.sock files)
But in apache httpd config
<VirtualHost *:80>
<Proxy *>
Require all granted
ProxyPass / http://localhost:8080/ retry=0
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on
ErrorLog /var/log/httpd/elasticbeanstalk-error_log
the proxy backend is ip address not unix socket
As per the config httpd should connect to backend ip address(localhost:8080) but why is it complaining about unix socket
Have anyone faced similar issues?
============= UPDATE
The error logs are suggesting connection error with backend unix socket
When we checked in /var/run/httpd/ folder, there were no unix sockets(.sock files)
But in apache httpd config
<VirtualHost *:80>
<Proxy *>
Require all granted
ProxyPass / http://localhost:8080/ retry=0
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on
ErrorLog /var/log/httpd/elasticbeanstalk-error_log
the proxy backend is ip address not unix socket
As per the config httpd should connect to backend ip address(localhost:8080) but why is it complaining about unix socket
Have anyone faced similar issues?

.Net Core 3.1 deploy on Centos 7

I am trying to run my .net Core web api application on Centos 7 + Plesk server. My application will be running in the subdomain. I set up a subdomain from the Plesk panel and transferred my files. After, I followed the article below step by step, it is not a very explanatory or helpful article.
https://learn.microsoft.com/tr-tr/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-3.1
First of all, this path does not exist /etc/nginx/sites-available/default. So with the help of other articles, I created the file api.mysite.com.conf in the etc/nginx/conf.d folder.
To configure Nginx as a reverse proxy to forward HTTP requests to your
ASP.NET Core app, modify /etc/nginx/sites-available/default. Open it
in a text editor, and replace the contents with the following snippet.
server {
listen 80;
server_name api.mysite.com *.mysite.com;
location / {
.... same as in docs.
}
}
Secondly, I created the service file by following the document. "/usr/bin/dotnet" This directory does not exist at this step, the document is not surprising again.
I solved this step by typing "/usr/share/dotnet/dotnet" instead of "/usr/bin/dotnet".
sudo nano /etc/systemd/system/kestrel-webapi.service
[Unit]
Description=Example .NET Web API App running on Centos 7
[Service]
WorkingDirectory=/var/www/vhosts/mysite.com/api.mysite.com
ExecStart=/usr/share/dotnet/dotnet /var/www/vhosts/mysite.com/api.mysite.com
After creating the service, I ran it without any problems.
The next step was Apache configuration.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-3.1
Configuration files for Apache are located within the
/etc/httpd/conf.d/ directory. Any file with the .conf extension is
processed in alphabetical order in addition to the module
configuration files in /etc/httpd/conf.modules.d/, which contains any
configuration files necessary to load modules.
I'm creating a configuration file in the "/etc/httpd/conf.d" file.
<VirtualHost *:*>
RequestHeader set "X-Forwarded-Proto" expr=${REQUEST_SCHEME}
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
ServerName www.mysite.com
ServerAlias *.mysite.com
ErrorLog ${APACHE_LOG_DIR}webapi-error.log
CustomLog ${APACHE_LOG_DIR}webapi-access.log common
</VirtualHost>
After making this configuration, I got an error while running the following commands in order.
sudo service httpd configtest
sudo systemctl restart httpd
[Fri May 28 19:35:02.344213 2021] [core:warn] [pid 25339:tid 139880432744576] AH00111: Config variable ${REQUEST_SCHEME} is not defined
[Fri May 28 19:35:02.344814 2021] [core:warn] [pid 25339:tid 139880432744576] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri May 28 19:35:02.344853 2021] [core:warn] [pid 25339:tid 139880432744576] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
Syntax OK
May 28 19:39:16 localhost.localdomain httpd[25740]: [Fri May 28 19:39:16.897163 2021] [core:warn] [pid 25740:tid 140630647605376] AH00111: Config variable ${REQUEST_SCHEME} is not defined
May 28 19:39:16 localhost.localdomain httpd[25740]: [Fri May 28 19:39:16.897775 2021] [core:warn] [pid 25740:tid 140630647605376] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
May 28 19:39:16 localhost.localdomain httpd[25740]: [Fri May 28 19:39:16.897825 2021] [core:warn] [pid 25740:tid 140630647605376] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
May 28 19:39:16 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 28 19:39:16 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
May 28 19:39:16 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
May 28 19:39:16 localhost.localdomain systemd[1]: httpd.service failed.
Before doing these operations, when I opened api.mysite.com through the browser, the plesk panel welcome page was displayed. I solved this problem by writing the following code, now I am getting 403 forbidden error.
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf_backup
How do I solve the above two problems? How can I redirect to my web api application when I connect to api.mysite.com?
I've been struggling with this for 3 days and I can't find the right articles on the internet, is there anyone who can help me?
I solved the problem.
When we create a domain in the plesk panel, apache creates its own configuration file, so all I have to do is change the Additional apache directives settings from within Apache & nginx under the Hosting & DNS settings of the relevant domain from the plesk panel.
Plesk --> Websites & Domains --> <> --> Hosting & DNS --> Apache & nginx
Additional directives for HTTP
Header set Access-Control-Allow-Origin "http://yourdomain.com"
Header set Access-Control-Allow-Headers "Access-Control-Allow-Headers, Origin, Accept,
X-Requested-With, Content-Type, Access-Control-Request-Method, Access-ControlRequest-Headers, Authorization, Content-Disposition"
Header set Access-Control-Allow-Methods "*"
Header set Access-Control-Allow-Credentials "true"
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
Additional directives for HTTPS
Header set Access-Control-Allow-Origin "https://yourdomain.com"
Header set Access-Control-Allow-Headers "Access-Control-Allow-Headers, Origin, Accept,
X-Requested-With, Content-Type, Access-Control-Request-Method, Access-ControlRequest-Headers, Authorization, Content-Disposition"
Header set Access-Control-Allow-Methods "*"
Header set Access-Control-Allow-Credentials "true"
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
If you have a cors problem, you can add lines starting with header set.
After doing all these, your application will run if it is ready in your service file.

Linux/Debian Apache2 mod_rewrite internal error

i have some problems to setup my mod_rewrite for my Joomla-Site.
Im using Apache 2.2.22 on Debian.
Website is on Directory: /home/web/beta/
What i did:
1) Commands:
sudo a2enmod rewrite
sudo mkdir -p /var/run/apache2
sudo chown -R www-data /var/run/apache2
sudo a2enmod actions
sudo /etc/init.d/apache2 force-reload
2) Then i setup following file: /etc/apache2/sites-enabled/000-default
<Directory /home/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
3) The htaccess file at path /home/web/beta/.htaccess i set:
RewriteEngine On
(I took the .htaccess from this site: http://www.joomla-security.de/downloads.html)
Ok, now the Problem.
As long as i set the AllowOverride to FileInfo i get following error message:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, webmaster#localhost and
inform them of the time the error occurred, and anything you might
have done that may have caused the error.
More information about this error may be available in the server error
log. Apache/2.2.22 (Debian) Server at XXXXXXX.com Port 80
What i did wrong?
Can you help me please?
EDIT: Error Log:
[Wed Nov 11 19:21:56 2015] [notice] caught SIGTERM, shutting down
[Wed Nov 11 19:21:57 2015] [notice] Apache/2.2.22 (Debian) PHP/5.4.45-0+deb7u2 configured -- resuming normal operations
[Wed Nov 11 19:21:57 2015] [alert] [client XX.XX.XX.198] /home/web/beta/.htaccess: Options not allowed here
[Wed Nov 11 19:21:58 2015] [alert] [client XX.XX.XX.198] /home/web/beta/.htaccess: Options not allowed here
[Wed Nov 11 19:21:59 2015] [alert] [client XX.XX.XX.144] /home/web/beta/.htaccess: Options not allowed here
It seems, from the errors you've posted, that you are trying to use the Options directive in .htaccess. To do that, you need to add Options to the AllowOverride directive in 000-default (cf. https://httpd.apache.org/docs/2.2/mod/core.html#options).
So change:
AllowOverride FileInfo
to
AllowOverride FileInfo Options
in 000-default.
Edit:
And if the above doesn't work, try changing it to:
AllowOverride All
And if that doesn't work then it could mean that other configuration files are getting loaded after 000-default and overwrite some of the directives.

Apache mod_wl2.4 plugin error parseJVMID

I have some issues with setting an clustered environment for weblogic and Apache. The structure is like this: 1 webserver that proxies requests to a clustered environment of 3 weblogic servers.
Everytime i send the request to the apache server , the request gets unhandled. I figured out a part of the problem , but that is something that is not intended in production. whenever i add DynamicServerList On the requests fail. When i switch it to off it works, but that means whenever a server fails , apache will still send requests to that server and user experience would be 0.
EDIT 1: I am using weblogic 12c and apache2.4 for Centos 7
EDIT 2: There is no firewall nor selinux active
Here is my config file for weblogic plugin:
<VirtualHost *:8080>
ServerAdmin postmaster#webserver2
ServerName webserver2
DocumentRoot /var/www/webserver2/htdocs
ErrorLog /var/log/httpd//webserver-error_log
CustomLog /var/log/httpd/webserver-access_log forwarded
<Directory />
AllowOverride all
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html
<Location />
SetHandler weblogic-handler
</Location>
<IfModule mod_weblogic.c>
WeblogicCluster 192.168.166.70:8001,192.168.166.71:8001,192.168.166.69:8001
ConnectTimeoutSecs 15
ConnectRetrySecs 10
WLIOTimeoutSecs 600
DynamicServerList ON
Idempotent ON
FileCaching ON
KeepAliveSecs 60
KeepAliveEnabled ON
DebugConfigInfo ON
</IfModule>
</VirtualHost>
And the errors I get are the following:
[Mon Sep 14 09:54:58.480616 2015] [weblogic:error] [pid 15343:tid
140547949991680] [client 172.18.132.50:57991] <1534314422136982>
parseJVMID: could not resolve hostname '-1062689209'. Returning NULL
from parseJVMID
[Mon Sep 14 09:54:58.480681 2015] [weblogic:error]
[pid 15343:tid 140547949991680] [client 172.18.132.50:57991]
<1534314422136982> initJVMID: parseClusterServerList failure
[Mon Sep
14 09:55:28.481215 2015] [weblogic:error] [pid 15343:tid
140547949991680] [client 172.18.132.50:57991] <1534314422136982>
request [/clusterjsp/HaJsp.jsp] did NOT process
successfully..................

localhost not reading htaccess, httpd AllowOverride All causes error

I am newbie trying to duplicate my online site on to a local server using Apache 2.2.22 and PHP 5.3.15. However, my localhost isn't reading the .htaccess file. I modified the example httpd.conf file and it registers the site correctly starting with localhost/index.php. But if I goto localhost/index I get a "Not Found" error. The .htaccess file works fine through my ISP (i.e. mysite.com/index works without a problem).
At first I thought it was a problem with my .htaccess rewrite
ErrorDocument 404 /404.php
RewriteEngine on
RewriteRule ^([a-zA-Z0-9]+)(/[a-zA-Z0-9/]+)?$ /$1\.php$2 [L]
But my localhost isn't reading the 404 error either which lead me to think it is the httpd.conf file. After some research a found a similar problem happens when the AllowOverride isn't switched to 'All'. Here is the what I had.
<Directory "D:/mywebfile/webserver/website/public_html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
When I switch it to AllOverride All, I get an "Internal Server Error" with the following log error
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 10.0.99.35 for ServerName [Sat Aug 04 15:15:55 2012] [notice] Child 9152: Child process is running
[Sat Aug 04 15:15:55 2012] [notice] Child 9152: Acquired the start mutex.
[Sat Aug 04 15:15:55 2012] [notice] Child 9152: Starting 64 worker threads.
[Sat Aug 04 15:15:55 2012] [notice] Child 4764: Released the start mutex
[Sat Aug 04 15:15:56 2012] [notice] Child 4764: All worker threads have exited.
[Sat Aug 04 15:15:56 2012] [notice] Child 4764: Child process is exiting
[Sat Aug 04 15:15:56 2012] [notice] Child 9152: Starting thread to listen on port 80.
[Sat Aug 04 15:15:58 2012] [alert] [client 127.0.0.1] D:/mywebfile/mywebserver/website/public_html/.htaccess: >Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
I have also tried to uncomment
#LoadModule rewrite_module modules/mod_rewrite.so
in the httpd file but I still get the same "Internal Server Error"
This seems like a simple problem but I've exhausted all my simple solutions. Any help will be greatly appreciated (and save me what little hair I haven't pulled out).
Thank you!
The problem is with the RewriteEngine command, not AllowOverride. That just activates the rewrite command.
Activating mod_rewrite is the way to go, the way you show. Make sure you are editing the right httpd.conf file and that you restart the server before trying again.

Resources