我正在使用CentOS8。
而apache是2.4.37版本。
Tomcat是8.5.47版本,
我正在使用tomcat-connectors-1.2.46。
httpd和tomcat之间的连接正在进行中。
但是,与ajp端口的连接仍然失败
我已经进行了所有设置。
mod_jk的日志详细信息
[Thu Nov 14 08:22:36.745 2019] [2520:140027283605248] [info] jk_open_socket::jk_connect.c (816): connect to 127.0.0.1:81 failed (errno=13)
[Thu Nov 14 08:22:36.746 2019] [2520:140027283605248] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1065): (instance1) Failed opening socket to (127.0.0.1:81) (errno=13)
[Thu Nov 14 08:22:36.746 2019] [2520:140027283605248] [error] ajp_send_request::jk_ajp_common.c (1725): (instance1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
[Thu Nov 14 08:22:36.746 2019] [2520:140027283605248] [info] ajp_service::jk_ajp_common.c (2775): (instance1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Thu Nov 14 08:22:36.849 2019] [2520:140027283605248] [info] jk_open_socket::jk_connect.c (816): connect to 127.0.0.1:81 failed (errno=13)
[Thu Nov 14 08:22:36.849 2019] [2520:140027283605248] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1065): (instance1) Failed opening socket to (127.0.0.1:81) (errno=13)
[Thu Nov 14 08:22:36.849 2019] [2520:140027283605248] [error] ajp_send_request::jk_ajp_common.c (1725): (instance1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
[Thu Nov 14 08:22:36.849 2019] [2520:140027283605248] [info] ajp_service::jk_ajp_common.c (2775): (instance1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Thu Nov 14 08:22:36.849 2019] [2520:140027283605248] [error] ajp_service::jk_ajp_common.c (2796): (instance1) connecting to tomcat failed (rc=-3, errors=9, client_errors=0).
[Thu Nov 14 08:22:36.849 2019] [2520:140027283605248] [info] jk_handler::mod_jk.c (2991): Service error=-3 for worker=instance1
httpd.conf
LoadModule jk_module modules/mod_jk.so
Include conf.modules.d/*.conf
<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot /usr/local/apache-tomcat-8.5.47/webapps
JKMount / instance1
JKMount /* instance1
<Directory "/usr/local/apache-tomcat-8.5.47/webapps">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
mod_jk.conf
<IfModule jk_module>
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile /etc/httpd/logs/mod_jk.log
JkLogLevel info
JkShmFile /etc/httpd/logs/mod_jk.shm
</IfModule>
worker.properties
worker.list=instance1
worker.instance1.port=8009
worker.instance1.host=127.0.0.1
worker.instance1.type=ajp13
server.xml
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="instance1">
SELinux端口列表
[a2mwps@test-wt-server ~]$ sudo semanage port -l | grep http_port_t
http_port_t tcp 12345, 8309, 8209, 8109, 80, 81, 443, 488, 8008, 8009, 8443, 9000
最后,我们使用Google Cloud Platform实例,并为VFC网络设置了防火墙接受规则。
最佳答案
Errno 13指示由于权限问题而无法打开套接字。诸如SELinux之类的东西可能正在阻止它。
关于linux - 使用mod_jk在apache和tomcat之间互通时无法连接到ajp端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58852963/