gpt4 book ai didi

oracle - mod_jk 给出错误的网关

转载 作者:行者123 更新时间:2023-11-28 22:11:13 28 4
gpt4 key购买 nike

我在 glassfish 服务器 4.1 版上运行 Oracle mapviewer。一直在8080端口运行没有问题,操作系统是Oracle Linux 4.1.12-61.1.22.el6uek.x86_64。最近我们决定通过 Apache webserver version 2.2 访问 glassfish 应用程序,这样我们将有更大的灵 active 。 Mod_jk 1.2 已经安装并且似乎在工作,因为我在 mod_jk.log 文件中得到“初始化”。

我已经用以下内容更新了 httpd.conf:

LoadModule jk_module modules/mod_jk.so

# We need a workers file exactly once
# and in the global server
JkWorkersFile conf/workers.properties

# Our JK error log
# You can (and should) use rotatelogs here
JkLogFile logs/mod_jk.log

# Our JK log level (trace,debug,info,warn,error)
JkLogLevel info

# Our JK shared memory file
JkShmFile logs/mod_jk.shm

# Define a new log format you can use in any CustomLog in order
# to add mod_jk specific information to your access log.
# LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" \"%{Set-Cookie}o\" %{pid}P %{tid}P %{JK_LB_FIRST_NAME}n %{JK_LB_LAST_NAME}n ACC %{JK_LB_LAST_ACCESSED}n ERR %{JK_LB_LAST_ERRORS}n BSY %{JK_LB_LAST_BUSY}n %{JK_LB_LAST_STATE}n %D" extended_jk

# This option will reject all requests, which contain an
# encoded percent sign (%25) or backslash (%5C) in the URL
# If you are sure, that your webapp doesn't use such
# URLs, enable the option to prevent double encoding attacks.
# Since: 1.2.24
# JkOptions +RejectUnsafeURI

# This option will collapse multiple adjacent slashes
# in request URLs before looking for mount or unmount
# matches.
# Since: 1.2.41
# JkOptions +CollapseSlashesAll

# After setting JkStripSession to "On", mod_jk will
# strip all ";jsessionid=..." from request URLs it
# does *not* forward to a backend.
# This is useful, if all links in a webapp use
# URLencoded session IDs and parts of the static
# content should be delivered directly by Apache.
# Of course you can also do it with mod_rewrite.
# Since: 1.2.21
# JkStripSession On

# Start a separate thread for internal tasks like
# idle connection probing, connection pool resizing
# and load value decay.
# Run these tasks every JkWatchdogInterval seconds.
# Since: 1.2.27
JkWatchdogInterval 60

# Configure access to jk-status and jk-manager
# If you want to make this available in a virtual host,
# either move this block into the virtual host
# or copy it logically there by including "JkMountCopy On"
# in the virtual host.
# Add an appropriate authentication method here!
<Location /jk-status>
# Inside Location we can omit the URL in JkMount
JkMount jk-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
<Location /jk-manager>
# Inside Location we can omit the URL in JkMount
JkMount jk-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

#<Location /mapviewer>
# # Inside Location we can omit the URL in JkMount
# JkMount mapviewer
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
#</Location>

# If you want to put all mounts into an external file
# that gets reloaded automatically after changes
# (with a default latency of 1 minute),
# you can define the name of the file here.
# JkMountFile conf/extra/uriworkermap.properties

# Send all /mapviewer/ requests to Glassfish.
JkMount /gsmapviewer/* mapviewer

# Example for Mounting a context to the worker "balancer"
# The URL syntax "a|b" instantiates two mounts at once,
# the first one is "a", the second one is "ab".
# JkMount /myapp|/* balancer

# Example for UnMounting requests for all workers
# using a simple URL pattern
# Since: 1.2.26
# JkUnMount /myapp/static/* *

# Example for UnMounting requests for a named worker
# JkUnMount /myapp/images/* balancer

# Example for UnMounting requests using regexps
# SetEnvIf REQUEST_URI "\.(htm|html|css|gif|jpg|js)$" no-jk

# Example for setting a reply timeout depending on the request URL
# Since: 1.2.27
# SetEnvIf Request_URI "/transactions/" JK_REPLY_TIMEOUT=600000

# Example for disabling reply timeouts for certain request URLs
# Since: 1.2.27
# SetEnvIf Request_URI "/reports/" JK_REPLY_TIMEOUT=0

# IMPORTANT: Mounts and virtual hosts
# If you are using VirtualHost elements, you
# - can put mounts only used in some virtual host into its VirtualHost element
# - can copy all global mounts to it using "JkMountCopy On" inside the VirtualHost
# - can copy all global mounts to all virtual hosts by putting
# "JkMountCopy All" into the global server
# Since: 1.2.26

我的 workers.properties 文件:

worker.list=jk-status
worker.jk-status.type=status

worker.jk-status.read_only=true

worker.list=jk-manager
worker.jk-manager.type=status

worker.list=mapviewer

# Mapviewer worker.
worker.mapviewer.host=localhost
worker.mapviewer.port=8009
worker.mapviewer.type=ajp13
worker.mapviewer.lbfactor=1

# Activation allows to configure
# whether this node should actually be used
# A: active (use node fully)
# D: disabled (only use, if sticky session needs this node)
# S: stopped (do not use)
# Since: 1.2.19
worker.mapviewer.activation=A

我还在 glassfish asadmin 中创建了以下监听器:

create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-http
create-network-listener --protocol http-listener-1 --listenerport 8009 --jkenabled true jk-connector

问题是,当我尝试访问 http://localhost/gsmapviewer/ 时,我收到 Bad gateway 错误。在 mod_jk.log 文件中,我得到:

[Sun Jun 18 10:51:47.024 2017] [29684:140425951717344] [info] init_jk::mod_jk.c (3595): mod_jk/1.2.42 initialized
[Sun Jun 18 10:52:23.033 2017] [4781:140425951717344] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1342): (mapviewer) can't receive the response header message from tomcat, tomcat (127.0.0.1:8009) has forced a connection close for socket 14
[Sun Jun 18 10:52:24.379 2017] [4781:140425951717344] [error] ajp_get_reply::jk_ajp_common.c (2259): (mapviewer) Tomcat is down or refused connection. No response has been sent to the client (yet)
[Sun Jun 18 10:52:24.379 2017] [4781:140425951717344] [info] ajp_service::jk_ajp_common.c (2778): (mapviewer) sending request to tomcat failed (recoverable), (attempt=1)
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1342): (mapviewer) can't receive the response header message from tomcat, tomcat (127.0.0.1:8009) has forced a connection close for socket 14
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [error] ajp_get_reply::jk_ajp_common.c (2259): (mapviewer) Tomcat is down or refused connection. No response has been sent to the client (yet)
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [info] ajp_service::jk_ajp_common.c (2778): (mapviewer) sending request to tomcat failed (recoverable), (attempt=2)
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [error] ajp_service::jk_ajp_common.c (2799): (mapviewer) connecting to tomcat failed (rc=0, errors=1, client_errors=0).
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [info] jk_handler::mod_jk.c (2995): Service error=0 for worker=mapviewer

最佳答案

我认为第二个命令是错误的。应该是

asadmin set server-config.network-config.network-listeners.network-listener.http-jk.jk-enabled=true

不确定这是否仍然适用于第二个网络监听器。我怀疑你必须先删除它。

关于oracle - mod_jk 给出错误的网关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44613254/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com