java中的独立ssl Web服务

时间:2014-03-29 10:53:53

标签: java web-services ssl

我在http://my-IP/中发布了一个带有java的独立Web服务,它可以运行。

import javax.xml.ws.Endpoint;

public class Publisher
{
    public static void main(String[] args) throws Exception
    {

        Endpoint.publish("http://172.16.58.13/", new TicketQueryImpl());
        System.out.println("UP");

    }
}

现在我想在SSL中制作并在https://my-IP/上发布。

我搜索了很多,但我没有找到任何好的样品或帮助。其中大多数不适用于独立并使用Tomcat或其他服务器。任何身体都可以帮助我!

1 个答案:

答案 0 :(得分:2)

SSL是一个非常复杂的野兽(来自编程方面)。为什么不使用代理请求的web服务的nginx或Apache之类的东西?即它获取SSL连接请求,并转发到在端口80中侦听的Web服务。

server {
    listen              443 ssl; # Listen to SSL connections
    ssl_certificate     www.example.com.crt;
    ssl_certificate_key www.example.com.key;
    ssl_protocols       SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    server_name         my-IP.com www.my-IP.com;
    access_log          /var/log/nginx/example.com.access.log main;
    access_log          /var/log/nginx/example.com.cache.log cache;
    error_log           /var/log/nginx/example.com.error.log error;

    location / {
        proxy_pass   http://localhost:80; # Forward requests to your webservice
    }
    Include     /etc/nginx/proxy.conf; # Proxy configuration
}

有关正确配置SSL服务器的详细信息,另请参阅http://nginx.org/en/docs/http/configuring_https_servers.html

相关问题