Tomcat application not responding with no logs - configuration

I have configured apache to froward request to tomcat. following are my configuration.
<VirtualHost *:80>
ServerName ***
ServerAlias ***
ServerAlias ***
RewriteEngine on
RewriteCond %{HTTP_HOST} =***
RewriteRule (.*) https://***/ [R]
RewriteCond %{HTTP_HOST} =***
RewriteRule (.*) https://***/ [R]
RewriteCond %{HTTP_HOST} =***
RewriteRule (.*) https://***/ [R]
</VirtualHost>
<VirtualHost *:443>
ServerName ***
ServerAlias ***
ServerAlias ***
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/***.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/***.key
SSLCACertificateFile /etc/pki/tls/certs/***.crt
</VirtualHost>
I am getting following error in apache log
[Sun Feb 26 23:28:28 2012] [error] (111)Connection refused: proxy: AJP: attempt to connect to 127.0.0.1:8009 (localhost) failed
[Sun Feb 26 23:28:28 2012] [error] ap_proxy_connect_backend disabling worker for (localhost)
[Sun Feb 26 23:28:28 2012] [error] proxy: AJP: failed to make connection to backend: localhost
[Sun Feb 26 23:28:29 2012] [error] proxy: AJP: disabled connection for (localhost)
[Sun Feb 26 23:28:29 2012] [error] proxy: AJP: disabled connection for (localhost)
It works correct for some time then suddenly I am getting the following error
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
When I tried netstat -antup | grep 8009 command I got the following
tcp 1 0 ::1:40293 ::1:8009 CLOSE_WAIT 32434/httpd
tcp 1 0 ::1:40288 ::1:8009 CLOSE_WAIT 32430/httpd
tcp 1 0 ::1:40289 ::1:8009 CLOSE_WAIT 32429/httpd
tcp 1 0 ::1:40294 ::1:8009 CLOSE_WAIT 32622/httpd
tcp 1 0 ::1:40292 ::1:8009 CLOSE_WAIT 32435/httpd
tcp 1 0 ::1:40290 ::1:8009 CLOSE_WAIT 32436/httpd
tcp 1 0 ::1:40287 ::1:8009 CLOSE_WAIT 32433/httpd
I cant figure out where my issue is. Is it with the apache configuration or with the tomcat configuration or it is a coding issue... I believe it is an configuration issue... Please help me..

I got two problem after fixing it tomcat is not crashing..
Got bad sectors in Hardisk.. I found in messages log so java was crashing..
I got old quartz schedulers running.. I deleted that then now the tomcat is not crashing..

Related

Site loading on port 443 and not on 80

I have site which isn't really working properly on SSL certificate.
The website works properly on 443 port with SSLEngine off directive in my configuration file, with SSLEngine on is responsing with 503 Error.
It also connects on port 80 by default and I don't really know where to change that because everywhere I have set port 443.
.htaccess file:
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://www.antoszbk.xyz/$1 [R,L]
configuration file (while working properly):
<VirtualHost *:443>
ServerAdmin xxx#xxx.com
DocumentRoot /var/www/html/index.html
ServerName antoszbk.xyz
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine off
SSLCertificateFile /etc/ssl/certs/www.antoszbk.xyz.csr
SSLCertificateKeyFile /etc/ssl/private/www.antoszbk.xyz.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
The solution was in DNS Server Configuration.
Certificate given to me by provider was set to antoszbk.xyz alias but in my SSL configuration I set it up to www.antoszbk.xyz. Still receive an error if trying to connect by IPv6 (AAAA record) redirection but it is a matter of time for the DNS to process it.

Getting a 502 Proxy error for POST route form to mysql db

After filling out a form on my live website, I get this message in the browser when I hit submit:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /contact.
Reason: Error reading from remote server
Apache/2.4.18 (Ubuntu) Server at (mysite) Port 80
ubuntu error log:
Mon Jan 22 00:12:21.518850 2018] [proxy:error] [pid 18331:tid 139839210997504] [client 24.245.70.116:62084] AH00898: Error reading from remote server returned by /contact, referer: (myurl)
.conf file:
<VirtualHost *:80>
ServerName www.(mysite).net
<Location "/">
ProxyPreserveHost On
ProxyPass http://localhost:3210/
ProxyPassReverse http://localhost:3210/
</Location>
</VirtualHost>
~

403 Error when accessing phpMyAdmin on an ec2 Instance

I wanted to install a LAMP environment on a new EC2 instance using Amazon-Linux following amazon's tutorial. Then I wanted to have phpMyAdmin so I installed it using sudo yum --enablerepo=epel install phpmyadmin and created a link to the www directory sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin.
Then I altered the /etc/httpd/conf.d/phpMyAdmin.conf file to allow access.
The current file:
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
Order allow,deny
Allow from all
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>
But still I'm getting a 403 error, when I try to access /phpMyAdmin
error_log:
[Thu Aug 27 13:45:47.702678 2015] [authz_core:error] [pid 25763] [client 37.49.61.176:59958] AH01630: client denied by server configuration: /usr/share/phpMyAdmin/
[Thu Aug 27 13:45:48.699611 2015] [authz_core:error] [pid 25763] [client 37.49.61.176:59958] AH01630: client denied by server configuration: /usr/share/phpMyAdmin/
[Thu Aug 27 13:49:22.181819 2015] [authz_core:error] [pid 25765] [client 37.49.61.176:60222] AH01630: client denied by server configuration: /usr/share/phpMyAdmin/
What else could be the error?
The issue was fixed after I removed
Alias /phpMyAdmin /usr/share/phpMyAdmin
from
/etc/httpd/conf.d/phpMyAdmin.conf
And then don't forget to restart by using the following command
sudo service httpd restart
Copy the following code in your /etc/httpd/conf.d/phpMyAdmin.conf
I found it here http://howsolve.com/i-always-get-a-403-error-with-phpmyadmin-ec2-aws/
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
Order allow,deny
Allow from all
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>

Apache authentication using MySQL via mod_authn_dbd fails

I am attempting to limit access to a directory using basic authentication with the user:password stored in a mysql database. Upon starting the Apache service with mod_authn_dbd enabled it creates about 60 to 70 MySQL processes, all of them have a command of "sleep". These errors however appear throughout the Apache log, and as a result of this error the authentication intermittently fails:
[Mon Aug 19 21:38:15 2013] [error] (20014)Internal error: DBD: failed to initialise
[Mon Aug 19 21:38:15 2013] [crit] (20014)Internal error: DBD: child init failed!
[Mon Aug 19 21:38:15 2013] [error] (20014)Internal error: DBD: Can't connect to mysql
I have tried adjusting MySQL connection limits and the DBD Parameters to fix this, without success.
This is my current configuration, with sensitive info removed:
<IfModule mod_authn_dbd.c>
DBDriver mysql
DBDParams "host=localhost port=3306 dbname=SITE_USERS user=DBUSER pass=DBPASS"
DBDExptime 300
DBDMin 1
DBDMax 10
</IfModule>
<Directory "/home/mysite/public_html/protected">
AuthCookieName CookieAuth
AuthCookieBase64 On
AuthType Basic
AuthName "Registered User"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM users WHERE username = %s"
Require valid-user
AllowOverride None
Order allow,deny
Allow from all
</Directory>
It seems like you're running into Bug #45995 mod_authn_dbd conflict with php+mysql.
As described in a related post, this is caused by a conflict between apache apr-util mysql driver and php mysql driver. You can either uninstall php-mysql if you are not using it, or if you are, you can downgrade apr and apr-util to version 1.3 or below.

Nginx CodeIgniter not working

I am new to nginx. I am transfering my server from apache to nginx but my many projects on the CodeIgniter core PHP sites working perfectly but the CodeIgniter is not work.
My sample url like this:
http://example.com/track/
this is redirect to:
http://example.com/track/index.php/sessions/login
but it returns 404 Not Found.
my server configure like this:
server {
listen 80;
server_name 192.168.0.80;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
my error log file like this
2013/05/15 10:21:37 [error] 2474#0: *3 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.0.11, server: 192.168.0.80, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.80"
2013/05/15 10:21:37 [error] 2474#0: *1 FastCGI sent in stderr: "Unable to open primary script: /usr/share/nginx/html/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.0.11, server: 192.168.0.80, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.0.80"
2013/05/15 10:22:05 [error] 2474#0: *1 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: Not a directory), client: 192.168.0.11, server: 192.168.0.80, request: "GET /track/index.php/sessions/login HTTP/1.1", host: "192.168.0.80"
2013/05/15 10:26:46 [error] 2474#0: *5 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: Not a directory), client: 192.168.0.11, server: 192.168.0.80, request: "GET /track/index.php/sessions/login HTTP/1.1", host: "192.168.0.80"
2013/05/15 10:28:33 [error] 2474#0: *7 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: Not a directory), client: 192.168.0.11, server: 192.168.0.80, request: "GET /track/index.php/sessions/login HTTP/1.1", host: "192.168.0.80"
2013/05/15 10:29:59 [error] 2497#0: *1 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: Not a directory), client: 192.168.0.11, server: 192.168.0.80, request: "GET /track/index.php/sessions/login HTTP/1.1", host: "192.168.0.80"
What's wrong? I did a search in google but not working perfectly.
Check out this link, should fix your rewriting issues.
If you have further questions you can ask.
Code igniter for nginx
Edit:
Ok so there's several ways to fix your case, but I'll describe the closest to your case
If you're going to edit in the same file as nginx conf as how I think you're doing right now then try adding this
location /track {
try_files $uri $uri/ /track/index.php;
}
Not sure if the routing needs $request_uri appended to index.php or not.
And i think you should configure CodeIgniter to be aware of this sub folder
$config['base_url'] = "192.168.0.80/track"
This isn't really the cleanest way to do this configuration, I'd prefer adding a domain name in the /etc/hosts and create a new separate server in nginx.
I ran into a similar problem earlier today: the code igniter URI routing requires that both the REQUEST_URI and the SCRIPT_NAME variables be defined. Many of the Nginx/PHP-FPM guides don't define the SCRIPT_NAME variable, so you end up with routing failures. You'll need to add a line that looks like this:
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
and then you can use REQUEST_URI in your config.php file and the routing should work.