tomcat - 请求登陆 Tomcat 的 catch-all 而不是所需的主机

标签 tomcat nginx railo lucee

在 OpenSuse VM 上设置新安装的 Nginx 和 Lucee 后,我现在可以通过内部 IP 和 Tomcat 端口访问 Lucee 管理,但是如果我尝试访问小测试页面,我设置完毕后,我最终进入了包罗万象的页面,这意味着 Lucee 的欢迎页面。

这可能是一件非常简单的事情,但我经常忽略可能导致它的细节,所以我希望你们中的一个能给我指出正确的方向。 这是 server.xml 和 nginx.conf 文件的精简版,删除了我已经推荐的所有内容,但没有发现任何区别。

基于域的主机 block 和定义的上游可以更轻松地在以后添加其他站点。

user  web-user;
worker_processes  2;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    use epoll;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    server_tokens off;
    server_names_hash_bucket_size 64;

    sendfile        on;
    keepalive_timeout  65;

    gzip    on;
    gzip_http_version   1.1;
    gzip_comp_level 4;
    gzip_types  text/plain text/javascript application/javascript text/css application/x-javascript application/xml application/xml+rss  application/json  application/font-woff;
    gzip_vary   on;

    upstream    lucee_servers {
        ip_hash;
        server  localhost:8888;
        keepalive   32;
    }

    #############
    # sites
    #############
    server {
        server_name .exampleurl.de;
        listen  80;
        root    /opt/wwwRailo/exampleurl;
        index index.cfm;

        expires 1h;
        add_header Pragma public;
        add_header Cacle-Control "public";

        # include vw/lucee-base-include.conf;

        location ~ \.(cfm|cfml)(.*)$ {
            proxy_pass          http://lucee_servers;
            proxy_redirect      off;

            proxy_http_version  1.1;
            proxy_set_header    Connection "";

            proxy_set_header    Host                $host;
            proxy_set_header    X-Forwarded-Host    $host;
            proxy_set_header    X-Forwarded-Server  $host;
            proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;     ## CGI.REMOTE_ADDR
            proxy_set_header    X-Forwarded-Proto   $scheme;                        ## CGI.SERVER_PORT_SECURE
            proxy_set_header    X-Real-IP           $remote_addr;
        }

        break;
    }

}

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
    <Listener className="org.apache.catalina.core.JasperListener" />
    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
    <Service name="Catalina">
    <Connector port="8888" protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="8443"
        useHttpOnly="true"/>
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

        <Engine name="Catalina" defaultHost="myDefaultHost">
            <Host name="myDefaultHost"  appBase="webapps"
            unpackWARs="false" autoDeploy="false">

            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
                prefix="localhost_access_log." suffix=".txt"
                pattern="%h %l %u %t &quot;%r&quot; %s %b" resolveHosts="false"/>
                <Valve className="mod_cfml.core"
                    loggingEnabled="false"
                    waitForContext="3"
                    maxContexts="200"
                    timeBetweenContexts="30000"
                />
            </Host>

            <Host name="exampleurl.de" appBase="webapps">
                <Alias>www.exampleurl.de</Alias>
                <Context path="" docBase="/opt/wwwRailo/priceBoard" useHttpOnly="true" />
            </Host>

        </Engine>

    </Service>
</Server>

提前感谢您的关注!

最佳答案

事实证明配置按预期工作,但管理员通过转发服务注册了域并忘记设置第二个设置。因此,不知何故只有 nginx 检测到请求的目标域,但 Tomcat 没有检测到,因此触发了默认行为,即“欢迎页面”。

关于tomcat - 请求登陆 Tomcat 的 catch-all 而不是所需的主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31315548/

相关文章:

unix - 为什么 TOMCAT 服务器在 unix 中自动重启?

java - 从 EC2 访问 UK API

Nginx Plus 不流式传输 HLS

tomcat - Railo Tomcat 404 重定向和 CGI​​ 变量

tomcat - 将 servlet jar 文件放在 Tomcat 6 中的什么位置?

java - Tomcat:缺少 startup.bat

ruby-on-rails - 使用 NGINX 和 Unicorn 在 Rails 3 应用程序中通过 SSL 提供 Assets 服务

docker - kubernetes docker 上的 Nginx 在生成 conf 时执行无限重定向

coldfusion - 在 lucee 或 railo 上的 cfml 文件中包含 cfc 中的接口(interface)函数

amazon-ec2 - 监控 I/O 请求