Tomcat
Apache 在配置了 mod_jk 的情況下返回 503 錯誤訪問地址
我有一個 Tomcat 伺服器在 10881 AJP 埠監聽。我通過 netstat 確認:
tcp 0 0 0.0.0.0:10881 0.0.0.0:* LISTEN 2297/java
這是Tomcat server.xml文件的配置:
<Connector port="10881" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" /> <Engine name="Catalina" defaultHost="localhost" jvmRoute="portal">
這是 worker.properties 文件:
worker.list=portal,jkstatus #liferay portal worker.portal.type=ajp13 worker.portal.host=localhost worker.portal.port=10881 #jk status worker.jkstatus.type=status
這是 VirtualHost 配置文件:
<VirtualHost *:80> DocumentRoot /var/www/html/portal ServerName portal.local ErrorLog "|/usr/sbin/rotatelogs /var/log/httpd/portal.local-error-log.%Y-%m-%d-%H_%M_%S 10M" CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/portal.local-access-log.%Y-%m-%d-%H_%M_%S 10M" combined #JkMount features JkMount /* portal <Directory /> Options +FollowSymLinks Order allow,deny Allow from all </Directory> </VirtualHost>
當我嘗試進入 portal.local 時,它會返回 503 錯誤程式碼。我查看了 mod_jk.log 文件,這是它的內容:
[Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1170): Attempting to map URI '/' from 1 maps [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] find_match::jk_uri_worker_map.c (984): Attempting to map context URI '/*=portal' source 'JkMount' [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] find_match::jk_uri_worker_map.c (997): Found a wildchar match '/*=portal' [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] jk_handler::mod_jk.c (2639): Into handler jakarta-servlet worker=portal r->proxyreq=0 [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] wc_get_worker_for_name::jk_worker.c (115): found a worker portal [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] wc_maintain::jk_worker.c (338): Maintaining worker portal [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] wc_get_name_for_type::jk_worker.c (292): Found worker type 'ajp13' [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] init_ws_service::mod_jk.c (1108): Service protocol=HTTP/1.1 method=GET ssl=false host=(null) addr=172.22.14.137 name=portal.local port=80 auth=(null) user=(null) laddr=172.22.14.68 raddr=172.22.14.137 uaddr=172.22.14.137 uri=/ [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_get_endpoint::jk_ajp_common.c (3213): acquired connection pool slot=0 after 0 retries [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (650): ajp marshaling done [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_service::jk_ajp_common.c (2500): processing portal with 2 retries [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_send_request::jk_ajp_common.c (1657): (portal) all endpoints are disconnected. [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] jk_open_socket::jk_connect.c (616): socket TCP_NODELAY set to On [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] jk_open_socket::jk_connect.c (740): trying to connect socket 24 to ::1:10881 [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] jk_open_socket::jk_connect.c (758): connect to ::1:10881 failed (errno=111) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (::1:10881) (errno=111) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [error] ajp_send_request::jk_ajp_common.c (1663): (portal) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] ajp_service::jk_ajp_common.c (2673): (portal) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_service::jk_ajp_common.c (2522): retry 1, sleeping for 100 ms before retrying [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_send_request::jk_ajp_common.c (1657): (portal) all endpoints are disconnected. [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] jk_open_socket::jk_connect.c (616): socket TCP_NODELAY set to On [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] jk_open_socket::jk_connect.c (740): trying to connect socket 24 to ::1:10881 [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] jk_open_socket::jk_connect.c (758): connect to ::1:10881 failed (errno=111) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (::1:10881) (errno=111) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [error] ajp_send_request::jk_ajp_common.c (1663): (portal) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] ajp_service::jk_ajp_common.c (2673): (portal) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [error] ajp_service::jk_ajp_common.c (2693): (portal) connecting to tomcat failed. [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_reset_endpoint::jk_ajp_common.c (810): (portal) resetting endpoint with socket -1 (socket shutdown) [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [debug] ajp_done::jk_ajp_common.c (3144): recycling connection pool for worker portal and socket -1 [Thu Mar 05 14:03:34 2015] [2766:140245744498752] [info] jk_handler::mod_jk.c (2806): Service error=-3 for worker=portal [Thu Mar 05 14:03:34 2015] [2798:140245744498752] [debug] do_shm_open::jk_shm.c (634): Attached shared memory /var/log/httpd/jk-runtime-status.2507 [7] size=1024 workers=0 free=0 addr=0x7f8d81c90000 [Thu Mar 05 14:03:34 2015] [2798:140245744498752] [debug] do_shm_open_lock::jk_shm.c (430): Duplicated shared memory lock /var/log/httpd/jk-runtime-status.2507.lock [Thu Mar 05 14:03:34 2015] [2798:140245744498752] [debug] jk_child_init::mod_jk.c (3266): Initialized mod_jk/1.2.40 [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1170): Attempting to map URI '/favicon.ico' from 1 maps [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] find_match::jk_uri_worker_map.c (984): Attempting to map context URI '/*=portal' source 'JkMount' [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] find_match::jk_uri_worker_map.c (997): Found a wildchar match '/*=portal' [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] jk_handler::mod_jk.c (2639): Into handler jakarta-servlet worker=portal r->proxyreq=0 [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] wc_get_worker_for_name::jk_worker.c (115): found a worker portal [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] wc_maintain::jk_worker.c (338): Maintaining worker portal [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] wc_get_name_for_type::jk_worker.c (292): Found worker type 'ajp13' [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] init_ws_service::mod_jk.c (1108): Service protocol=HTTP/1.1 method=GET ssl=false host=(null) addr=172.22.14.137 name=portal.local port=80 auth=(null) user=(null) laddr=172.22.14.68 raddr=172.22.14.137 uaddr=172.22.14.137 uri=/favicon.ico [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_get_endpoint::jk_ajp_common.c (3213): acquired connection pool slot=0 after 0 retries [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (650): ajp marshaling done [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_service::jk_ajp_common.c (2500): processing portal with 2 retries [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_send_request::jk_ajp_common.c (1657): (portal) all endpoints are disconnected. [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] jk_open_socket::jk_connect.c (616): socket TCP_NODELAY set to On [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] jk_open_socket::jk_connect.c (740): trying to connect socket 24 to ::1:10881 [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] jk_open_socket::jk_connect.c (758): connect to ::1:10881 failed (errno=111) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (::1:10881) (errno=111) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [error] ajp_send_request::jk_ajp_common.c (1663): (portal) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] ajp_service::jk_ajp_common.c (2673): (portal) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_service::jk_ajp_common.c (2522): retry 1, sleeping for 100 ms before retrying [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_send_request::jk_ajp_common.c (1657): (portal) all endpoints are disconnected. [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] jk_open_socket::jk_connect.c (616): socket TCP_NODELAY set to On [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] jk_open_socket::jk_connect.c (740): trying to connect socket 24 to ::1:10881 [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] jk_open_socket::jk_connect.c (758): connect to ::1:10881 failed (errno=111) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (::1:10881) (errno=111) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [error] ajp_send_request::jk_ajp_common.c (1663): (portal) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] ajp_service::jk_ajp_common.c (2673): (portal) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [error] ajp_service::jk_ajp_common.c (2693): (portal) connecting to tomcat failed. [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_reset_endpoint::jk_ajp_common.c (810): (portal) resetting endpoint with socket -1 (socket shutdown) [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [debug] ajp_done::jk_ajp_common.c (3144): recycling connection pool for worker portal and socket -1 [Thu Mar 05 14:03:37 2015] [2763:140245744498752] [info] jk_handler::mod_jk.c (2806): Service error=-3 for worker=portal
我可以看到一個 111 錯誤,說埠可能沒有在監聽,但正如我所寫的那樣。我不知道問題出在哪裡。
問題是 mod_jk 版本。我從最新版本的 Tomcat 連接器 (1.2.40) 編譯它。然後我嘗試用較低版本的 TC (1.2.35) 編譯它並且它工作。