V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
chaegumi
V2EX  ›  程序员

被 tomcat 的 8443 访问配置折磨了

  •  
  •   chaegumi ·
    chaegumi · 2016-04-12 14:20:15 +08:00 · 2682 次点击
    这是一个创建于 2941 天前的主题,其中的信息可能已经有所发展或是发生改变。
    求分析指教

    我的 tomcat 版本是 8.5.0
    系统是 centos6

    版本那么多,默认的 server.xml 还跟文档中的不一致。

    现在的情况是这样的:

    我的域名的 443 端口 已经绑定在 nginx 了,可以正常使用

    我现在想要把同一个域名的 8443 端口绑定到 tomcat 上边来。这个能实现吗?

    这个 8443 的出错哪里去看日志。

    server.xml 中的配置是:

    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
    maxThreads="150" scheme="https" secure="true" SSLEnabled="true" keystoreFile="/root/domain.kdb" keystorePass="pass" clientAuth="false" sslProtocol="TLS">
    </Connector>
    7 条回复    2016-04-12 17:19:59 +08:00
    realpg
        1
    realpg  
       2016-04-12 15:20:19 +08:00   ❤️ 1
    tomcat 监听指定一个 IP 比如 127.0.0.2
    然后 nginx 直接反代过去
    letitbesqzr
        2
    letitbesqzr  
       2016-04-12 15:58:29 +08:00   ❤️ 1
    client -> nginx(ssl) -> tomcat

    tomcat 不需要再配置 nginx 了..

    发下我的一个配置:
    ```
    <Host name="www.xxxxx.com" appBase=""
    unpackWARs="false" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" reloadable="true" workDir="work" docBase="project/cmc"/>
    </Host>
    ```

    nginx
    ```
    server {
    listen 443;
    server_name www.xxxxx.com;
    access_log /var/log/weblog/xxxx_com_access.log main;
    error_log /var/log/weblog/xxxx_com_error.log debug;
    ssl on;
    ssl_certificate /usr/local/nginx/conf/ssl/xxxx.crt;
    ssl_certificate_key /usr/local/nginx/conf/ssl/xxxx.key;
    location /
    {
    proxy_pass http://127.0.0.1:2600; // tomcat port
    include naproxy.conf;
    }
    }
    ```

    naproxy.conf
    ```
    proxy_connect_timeout 30s;
    proxy_send_timeout 90;
    proxy_read_timeout 90;
    proxy_buffer_size 32k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_redirect off;
    proxy_hide_header Vary;
    proxy_set_header Accept-Encoding '';
    proxy_set_header Host $host;
    proxy_set_header Referer $http_referer;
    proxy_set_header Cookie $http_cookie;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    ```
    chaegumi
        3
    chaegumi  
    OP
       2016-04-12 16:05:17 +08:00
    我现在要往 nginx 代理到 tomcat 思路转了, tomcat 的文档不好阅读,关联页面太多。我仅仅只是想要用 cas sso 这个项目而已。
    chaegumi
        4
    chaegumi  
    OP
       2016-04-12 16:48:19 +08:00
    defunct9
        5
    defunct9  
       2016-04-12 17:01:03 +08:00
    chaegumi
        6
    chaegumi  
    OP
       2016-04-12 17:04:43 +08:00
    @defunct9 网上搜索的配置都不成功,用 nginx 反代,马上就好了
    defunct9
        7
    defunct9  
       2016-04-12 17:19:59 +08:00
    @chaegumi 用 nginx 反代呢, ssl 解析速度加快,但是需要单独维护 nginx 这个进程。不用 nginx 反代呢,单独进程, ssl 解析速度变慢,但是好维护。看怎么取舍了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2194 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:29 · PVG 19:29 · LAX 04:29 · JFK 07:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.