请求登陆 Tomcat 的包罗万象而不是所需的主机
Request lands in Tomcat's catch-all instead of the desired host
在 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 "%r" %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 没有检测到,因此触发了默认行为,这意味着 "welcome page".
在 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 "%r" %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 没有检测到,因此触发了默认行为,这意味着 "welcome page".