0

在 OpenSuse VM 上设置新的 Nginx 和 Lucee 安装后,我现在可以通过内部 IP 和 Tomcat 端口访问 Lucee 管理员,但是如果我尝试访问我设置的小测试页面起来,我最终选择了全称,意思是 Lucee 的欢迎页面。

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

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

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>

提前感谢您的观看!

4

1 回答 1

0

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

于 2015-07-10T14:27:23.220 回答