Mod_jk workers - ipv4 / ipv6 /fqdn - apache

I just set up our first machine with Ubuntu 16 LTS and Tomcat 8.5.11 + Apache/2.4.18, mod_jk/1.2.41.
I was quiet familiar with Ubuntu 14 LTS, Tomcat 7.0.70 and Apache/2.4.7 mod_jk/1.2.37.
Deploying my servlet seemed fine, no errors in tomcat or app log, but still not avail.
Using fqdn/app showed an error 503.
Using ip:port/app worked fine..
I saw these entries in mod_jk.log:
[Fri Feb 24 11:17:49.149 2017] [9219:139689407260416] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1068): (worker1) Failed opening socket to (::1:8009) (errno=111)
[Fri Feb 24 11:17:49.149 2017] [9219:139689407260416] [error] ajp_send_request::jk_ajp_common.c (1728): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
-> ::1:8009
Why is my worker.host=localhost resolved to ::1 (IPv6) instead of 127.0.0.1 (IPv4)?
I also saw the "newer" parameter "prefer_ipv6" and set it to "worker.prefer_ipv6=0" but without luck..
Workaround:
When I set the worker.host=127.0.0.1 everything works fine/as I am used to.
Downside:
I know some collegue of mine has changed the 127.0.0.1 entry to "localhost" in the past for some reason (different ip stack in processing?), so I am not 100% confident leaving it with IPv4-IP.
Some advices on how I could fix that?

It's a bug in the JK connector, where it always prefers IPv6 when resolving the hostname in the "worker.*.host=" setting. The only way to force the latest JK connector to connect via IPv4 is to use an IPv4 address (rather than a DNS name).
The other alternative is to configure tomcat AJP/1.3 listener to listen on IPv6.
Until the folks at Apache fix the bug in the JK connector, these are the only options right now.

Related

Coldfusion 2018 on Centos 7 failing to setup Apache connector

I've installing CF2018 on a new server, which is installed and running, I can see it if I run ps aux | ack -i coldfusion
$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
$ httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Jul 29 2019 17:18:49
UPDATE
I had clearly broken something so I've removed earlier errors, but I'm still getting issues with the connector.
I have removed all references and files relating to mod_jk from /etc/httpd/conf, reinstalled CF then re-ran the connector.
It's installed successfully with this command:
$ sudo ./wsconfig -ws Apache -dir /etc/httpd/conf
I have the dir at /opt/coldfusion2018/config/wsconfig/1 setup but I'm now getting these errors:
$ pwd
/opt/coldfusion2018/config/wsconfig/1
$ tail mod_jk.log
[error] ajp_service::jk_ajp_common.c (3000): (cfusion) connecting to tomcat failed (rc=-3, errors=583, client_errors=0).
[info] jk_open_socket::jk_connect.c (816): connect to ::1:8018 failed (errno=13)
[info] ajp_connect_to_endpoint::jk_ajp_common.c (1140): (cfusion) Failed opening socket to (::1:8018) (errno=13)
[error] ajp_send_request::jk_ajp_common.c (1811): (cfusion) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
[info] ajp_service::jk_ajp_common.c (2979): (cfusion) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[info] jk_open_socket::jk_connect.c (816): connect to ::1:8018 failed (errno=13)
[info] ajp_connect_to_endpoint::jk_ajp_common.c (1140): (cfusion) Failed opening socket to (::1:8018) (errno=13)
[error] ajp_send_request::jk_ajp_common.c (1811): (cfusion) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
[info] ajp_service::jk_ajp_common.c (2979): (cfusion) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[error] ajp_service::jk_ajp_common.c (3000): (cfusion) connecting to tomcat failed (rc=-3, errors=584, client_errors=0).
I have no idea where port 8018 has come from, I thought tomcat used 8500 by default
UPDATE 2
If I visit my site with :8500 on the end I can get into the CFIDE, so it's CF is running and that port is accessible
UPDATE 3
I've found this in my server.xml file, tried setting the port to both 8009 and 8018 and it seems to make no difference to the errors in the mod_jk.log
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!-- begin connector -->
<Connector port="8009" packetSize="65535" protocol="AJP/1.3" redirectPort="8451" tomcatAuthentication="false" maxThreads="500" connectionTimeout="60000"/>
<!-- end connector -->
Pete,
What's the OS and the webserver's version?
Did you try passing the parameters other than dir, explicitly, like so:
sudo ./wsconfig -ws Apache /opt/apache2/conf -bin /opt/apache2/bin/httpd -script /opt/apache2/bin/apachectl -dir -v
..and the coldfusion process need not be running for the connector to be configured.
8018 is the default AJP port that the conector uses to talk to tomcat. 8500 is the default HTTP port that you'd use when you access the CF admin console.
You initially reported error when configuring the connector. Is that resolved.
Did you check the wsconfig log to see if there were errors configuring the connector.
The modjk log excrepts you've shared more recently simply indicate that CF is not running, or at the least, not listening on the default AJP port.
The problem was SELinux blocking port 8018, I actually asked my hosting provider Secura to look into this for me and they fixed it (based on all the information I'd found from piyush's answer)
I had to allow port 8018 in SELinux
semanage port -a -t http_port_t -p tcp 8018

Service Unavailable. Apache2 centos 7

I have installed apache in centos 7. PHP version 7.1 and php-fpm. I had restarted system. Afterward, apache is working but once i access any file it show me below error.
503 service Unavailable
Service Unavailable
The server is temporarily unable to service your request due to
maintenance downtime or capacity problems. Please try again later.
Apache log:
[Tue Nov 13 18:25:25.171750 2018] [proxy:error] [pid 13059]
(111)Connection refused: AH00957: FCGI: attempt to connect to
127.0.0.1:6000 (127.0.0.1) failed
Please help me to fix this issue.
Finally i got solution of the error. I just uninstall PHP-fpm and used standard PHP 7.1 version and restarted HTTPD services. Its working fine.

MAMP Pro 5.0.3 SSL Failure

All sites work fine when SSL is not enabled. Once I enable it, it fails...
I installed MAMP Pro 5.0.3 today hoping that might change things. Tried SSL again, got a failure and this message from the log:
[Tue Aug 07 16:14:53 2018] [notice] Graceful restart requested, doing restart
(48)Address already in use: make_sock: could not bind to address 10.20.1.10:80
no listening sockets available, shutting down
Can anyone help me figure out what is going on here? (Oh, and how to fix it....) Thanks in advance...

Apache Server Won't Start in MAMP

Apache server won't start when in MAMP. Here are the error logs:
[Wed Aug 01 21:07:34 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 01 21:07:34 2012] [notice] Digest: done
[Wed Aug 01 21:07:34 2012] [notice] Apache/2.0.63 (Unix) PHP/5.3.2 DAV/2 configured -- resuming normal operations
[Wed Aug 01 21:08:00 2012] [notice] caught SIGTERM, shutting down
[Wed Aug 01 21:08:01 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 01 21:08:01 2012] [notice] Digest: done
[Wed Aug 01 21:08:01 2012] [notice] Apache/2.0.63 (Unix) PHP/5.3.2 DAV/2 configured -- resuming normal operations
[Wed Aug 01 21:08:51 2012] [notice] caught SIGTERM, shutting down
I don't think I did anything our of the ordinary except create a new folder in htdocs. Any suggestions?
My solution:
in /Applications/Mamp/Library/bin, find the file envvars and rename it to _envvars.
now it works.
I encountered this same issue with the same log output above, but did not need to reinstall MAMP to solve the issue in my case. When I encountered this error it was related to one of the hosts I had set up. Click the Hosts tab and see if any of your hosts appear in red:
The host in red required SSL certificates. In the configuration I did not have valid references to the required certificates after I had altered the file structure of my application. After fixing this issue and applying changes the host was no longer highlighted in red, and I was able to start Apache through MAMP.
Additionally, you can ensure that the problem doesn't have to do with your Apache client itself by running this command in terminal:
sudo /Applications/MAMP/Library/bin/apachectl restart
OR
sudo /Applications/MAMP\ PRO/Library/bin/apachectl restart
If you are able to start Apache in terminal, you have ruled out that you have an error with MAMP's Apache client itself.
Change the name of the file envvars to _envvars in /Applications/MAMP/Library/bin , thats it .
Instead of reinstalling mamp I did the following:
1. Moved back to default mamp ports
2. Started mamp
3. Stopped mamp
4. Went back to ports 80 443 3306
and it started working.
Just reinstalled MAMP and changed the ports. Not sure what the problem was, but it's fixed now.
If your existing MAMP PRO suddenly won't start Apache anymore, then it might be an error in vhosts settings which is not visible.
There is often no indication in apache_error.log - it just comes up with the message.
Apache wasn't able to start. Please check log for more information.
In my case it was a wrong path in Customized virtual host settings such as
Include /path/to/project/rewrite.conf
Vhost config is saved in ~/Library/Application Support/appsolute/MAMP PRO/httpd.conf so you can check the settings there.
Solution: MAMP 4 - Dec 2017, macOS High Sierra
Had this issue with MAMP Pro 3.4.1 so i paid for a new license so i could upgrade to Version 4.2.1 and the problem still occurred. I tried the above solution and unfortunately had no luck.
I did however get Apache running again by selection all options for the directory directive as shown in the image below:
This issue occurred completely randomly, one day everything working fine then the next... Apache says no. I believe the issue is that like web browsers use a Cache and separately also hold open processes, i think sometimes when MAMP or MAMP Pro is not closed properly then it can screw up Apache because it is not stopped correctly.
I hope this answer helps any persons experiencing this issue!
In case above answers didn't fix it, you can check that Document Root isn't set on some non-existing directory.
Go to MAMP Settings > Web-Server > Document Root
I found a Solution:
JUST:
in /Applications/Mamp/Library/bin, find the file envvars and rename it to _envvars.
this issue comes to me today …
after trying several solutions, i found this dialog message may appear if MAMP no longer finds a certificate used by a securized localhost.
So be careful to keep them in a place you won't move or delete.
hope it helps

Apache Server will not start on MAMP

Im still very new to this so please go easy on me. When i click on MAMP, the light for the apache will turn on, then turn off but the mysql will remain on and work. But the localhost wont work, displaying the error "localhost refused to connect."
I searched online and tried changing the port from 80 to the default 8888 but it still does not work. When i check the error logs on MAMP/logs/apache_error, and it displays
[warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[warn] pid file C:/MAMP/bin/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
Please help, im using windows 10, im a complete newbie
I had the same problem.
I've changed PHP standard version from 7.3.7 to 7.2.14 and restarted. it worked.