AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 413789
Accepted
ccot
ccot
Asked: 2012-08-03 13:03:34 +0800 CST2012-08-03 13:03:34 +0800 CST 2012-08-03 13:03:34 +0800 CST

Glassfish 前面的 Apache:https(443) 上的 mod_jk

  • 772

在推荐在 glassfish 前面使用Apache http 服务器(检查问题)之后,我使用了以下教程 并使其工作但仅在端口 80 上运行。
我的意思是现在我可以输入:

www.mydomain.com

它运行。但是,如果我运行一个需要 https 的应用程序,即在 web.xml(一个 J2EE 应用程序)中

<transport-guarantee>CONFIDENTIAL</transport-guarantee>

当我输入:

www.mydomain.com

它会自动加载:

https://www.mydomain.com:8181

我不想显示端口 8181,我只想:https ://www.mydomain.com 。

PS:我将只使用一个在上下文“/”中运行的应用程序。

以下是我的配置:

* workers.properties文件:

worker.list=ajp13unsecure, ajp13secure

worker.ajp13unsecure.type=ajp13
worker.ajp13unsecure.host=localhost
worker.ajp13unsecure.port=8009

worker.ajp13secure.type=ajp13
worker.ajp13secure.host=localhost
worker.ajp13secure.port=8009

*我添加的 httpd.conf文件:

Listen 443

# Load mod_jk module
# Update this path to match your modules location
LoadModule    jk_module  modules/mod_jk.so

# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile conf/workers.properties

# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to  access_log)
# This can be commented out, to disable logging
JkLogFile     logs/mod_jk.log

# Set the jk log level [debug/error/info]
# Only matters if JkLogFile is being used.
JkLogLevel    debug

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# JkOptions indicate to send SSL KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"

# Send everything for context /examples to worker named worker1 (ajp13)
# /examples would most likely be the name of your WebApp (c:/tomcat/webapps/example)
JkMount  /* ajp13secure

# Should mod_jk send SSL information (default is On)
JkExtractSSL On
# What is the indicator for SSL (default is HTTPS)
JkHTTPSIndicator HTTPS
# What is the indicator for SSL session (default is SSL_SESSION_ID)
JkSESSIONIndicator SSL_SESSION_ID
# What is the indicator for client SSL cipher suit (default is SSL_CIPHER)
JkCIPHERIndicator SSL_CIPHER
# What is the indicator for the client SSL certificated? (default is SSL_CLIENT_CERT)
JkCERTSIndicator SSL_CLIENT_CERT

问题:
我缺少什么,以便端口 8181 不再出现在 URL 中?

另外,正如我所说,SSL 证书已经安装在 glassfish 中,我是否必须将其安装在 Apache 中或那样就可以了?

PS:我正在使用

  • 玻璃鱼 v3.0.1
  • 视窗服务器 2008 r2
  • 阿帕奇 v2.2
  • 我已经在 glassfish keystore中安装了一个 godaddy SSL 证书。它工作正常并且运行良好。
apache-2.2
  • 1 1 个回答
  • 3748 Views

1 个回答

  • Voted
  1. Best Answer
    DerfK
    2012-08-03T15:20:48+08:002012-08-03T15:20:48+08:00

    这是您的应用程序发出重定向以强制您通过 SSL 连接的结果。问题是因为 glassfish 现在在代理后面,应用程序不知道它运行的端口不是人们应该使用的端口。在某处,应该有配置来覆盖要使用的端口。

    这个特定问题的简单解决方案是使用 Apache 而不是 Java 来处理强迫人们使用 SSL,您可以使用mod_rewrite来做到这一点:

    RewriteEngine On
    RewriteCond %{HTTPS} !=on    
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    

    也就是说,真正的解决方案是找出 URL 重定向的来源以及如何重新配置​​它。这个问题很可能会出现在您的应用程序创建 URL 的其他地方,例如用户注册电子邮件。

    (免责声明:我对 Glassfish/J2EE/所有这些繁琐的小 Java 位是如何组合在一起一无所知,所以我不确定该 URL 正在堆栈中的确切位置构造,或者您必须更改哪些内容才能修复它)

    • 1

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 上的子域不工作 - 找不到服务器

  • PHP 作为 CGI 还是 Apache 模块?

  • 避免将某些丢失的文件记录到 Apache2 错误日志中

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve