我有apache 2.2.3和jboss 5.1安装在我的服务器,在阿帕奇我有2个应用程序在php + mysql和jboss我有根应用程序(/)liferay门户。 我使用mod_proxy到达jboss应用程序:
<VirtualHost server_ip:80> ServerName intranet.mycompany.com ProxyPreserveHost On ProxyPass / balancer://jbosscluster/ ProxyPassReverse / http://server_ip:8080 </VirtualHost>
但现在我必须启用https只在intranet.mycompany.com,我不知道在哪里configurationSSL,在Apache,JBoss,两者。 我尝试在jboss中的server.xml,生成keytool自签名证书,但Apache不转发到https:// server_ip:8443
我会感谢您的帮助。
如果所有的东西都在同一台服务器上,那么你所要做的就是在Apache中设置SSL – 确保安装了mod_ssl,并且使用默认的configuration风格使其运行。 Apache <=> JBoss通信将在通常情况下在同一台服务器上进行,并且是未encryption的。
给定一个安装了mod_ssl软件包的标准linux(CentOS,例如)盒子:
# SSL Basics LoadModule ssl_module modules/mod_ssl.so Listen 443 NameVirtualHost *:443 AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl SSLPassPhraseDialog builtin SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000) SSLSessionCacheTimeout 300 SSLMutex default SSLRandomSeed startup file:/dev/urandom 256 SSLRandomSeed connect builtin SSLCryptoDevice builtin <VirtualHost _default_:443> ...config stuff... ServerName intranet.mycompany.com ProxyPreserveHost On ProxyPass / balancer://jbosscluster/ ProxyPassReverse / http://127.0.0.1:8080 SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW SSLCertificateFile /path/to/server.pem SSLCertificateKeyFile /path/to/server.pem <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog logs/ssl_request_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" ...more config stuff... </VirtualHost>
文件server.pem包含未encryption的服务器密钥和从上游机构返回的服务器证书。
/usr/bin/openssl genrsa -des3 1024 > server.key.encrypted /usr/bin/openssl rsa -in server.key.encrypted -out server.key /usr/bin/openssl req -new -key server.key -out server.csr cat server.key > server.pem cat server.crt >> server.pem
这是基本的想法 – server.crt是从Thawte等给你的server.csr文件(和金钱)给你的文件。
troyengel的答案会给你通过你的Apacheconfiguration的HTTPS访问,但如果我正确地理解你的问题,你需要intranet.mycompany.com只能通过HTTPS而不是通过HTTP访问?
如果是这样的话,我会修改你现有的虚拟主机声明是一些东西:
<VirtualHost server_ip:80> ServerName intranet.mycompany.com RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] </VirtualHost>
这是除了troyengel的SSL VirtualHostconfiguration。 这应该然后redirect任何去http://intranet.mycompany.com – > https://intranet.mycompany.com自动保持请求的URI。