Articles of tomcat

当我使用nginx代理传递URL时,为什么URL重写不能在tomcat 8中工作

当从nginx服务器传递代理请求时, Tomcat 8 URL重写不起作用。 但是,当直接从tomcat服务器提供请求时,相同的url-rewrite正在工作。 我正在监听80端口的nginx服务器和监听9080端口的tomcat服务器。 nginx proxy-passconfiguration http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; location /app/ { proxy_pass http://localhost:9080/; proxy_set_header Host $host:$server_port; } } } tomcat rewrite.config文件 RewriteRule ^app/xyz /app/abc [L] 当我尝试访问url http:// server-name / app / xyz时 ,URL重写不起作用。 但是当直接通过tomcat侦听端口(服务器名称:9080 / app / xyz)访问它正在工作。 编辑 以前我在nginx中configuration了URL重写。 nginx […]

使用Apache2(或Nginx)处理Http请求。 是否为每个或一组N个请求创build一个新的进程?

Web服务器(WS)(比如apache2或者nginix(或者像tomcat(TC)这样的容器)会创build一个新的进程来处理接收到的请求,我担心的是支持大量并行用户(比如20K +并行用户)的服务器。 我认为负载平衡发生在Web服务器的另一端(如果它用于Tomcat等)。 所以从理论上讲,一个Web服务器应该接受所有(20K +)传入请求,然后才能将负载分发给支持它的其他服务器。 所以,问题是:Web服务器(WS)在一个进程中处理所有这些请求,或者巧妙地产生其他进程来帮助共享工作(我知道“客户端 – 服务器”绑定发生 – client_host:random_port plus server_host: fixed_port )。 参考资料:在阅读本文之前: 用Apache来面向Tomcat我认为这是一个完成所有聪明工作的单一过程。 但是在这篇文章中提到了MPM(多处理模块) 它结合了两个世界中最好的,有一组subprocess,每个进程有一组独立的线程。 有些网站正在使用此技术运行10K +并发连接。 而且随着线程的产生,如上所述,线程变得越来越复杂。 (这些不是通过调用服务方法为每个单独请求提供服务的tomcat线程,而是Apache WS上的线程来处理请求并将其分发到节点进行处理。 如果有人使用MPM。 所有这些工作如何进一步的解释将是伟大的。 像 – (1)随着儿童进程的产生,确切的作用是什么。 是subprocess只是为了调解的请求到tomcat或更多的事情。 如果是这样,那么在subprocess得到TC的响应后,subprocess是否将响应转发给父进程或直接发送给客户端(因为它可以从父进程得知client_host:random_port ,我不确定这是否允许在理论,虽然subprocess不能接受任何新的请求,因为只能绑定到一个进程的fixed_port已经绑定到父进程。 (2)由subprocess或父进程共享什么样的负载。 再次,它几乎必须和(1)中的一样。 但是我不确定的是,即使在理论上,如果一个线程可以直接发送请求到客户端。

axis2 webapp后面的反向代理产生错误的位置

Java / Tomcat中的SSLconfiguration就是这样,我configuration了一个tomcat6实例,以获取来自处理SSL的nginx反向代理的请求,代理到localhost:8080的连接。 像X-Forwarded-For一样添加标头可确保端点显示正确的地址,但不能使用正确的协议。 一个客户端(在我的情况下是python-suds)很好地检索WSDL,但是为SOAP端口find以下位置: <wsdl:service name="WebService"> <wsdl:port name="WebServiceHttpSoap11Endpoint" binding="ns:WebServiceSoap11Binding"> <soap:address location="http://10.10.3.96/axis2/services/WebService.WebServiceHttpSoap11Endpoint/"/> </wsdl:port> <wsdl:port name="WebServiceHttpSoap12Endpoint" binding="ns:WebServiceSoap12Binding"> <soap12:address location="http://10.10.3.96/axis2/services/WebService.WebServiceHttpSoap12Endpoint/"/> </wsdl:port> <wsdl:port name="WebServiceHttpEndpoint" binding="ns:WebServiceHttpBinding"> <http:address location="http://10.10.3.96/axis2/services/WebService.WebServiceHttpEndpoint/"/> </wsdl:port> </wsdl:service> 我怀疑它的http://抛出它,因为试图使用这个结果在tomcat的日志中的错误和以下消息: org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /axis2/services/WebService.WebServiceHttpSoap11Endpoint/ and the WSA Action = null. If this EPR was previously reachable, please contact the server […]

tomcat web应用程序的上下文path作为反向代理与Nginx面向前进

我试图在Nginx上部署一个Tomcat服务器上的Web应用程序。 我遇到的问题是标签在我的JSP页面打印出“不正确的”(从tomcatangular度来看是正确的)上下文path。 我的Tomcat上的Web应用程序部署在上下文path:/ webApp1与端口8080上运行的Tomcat。因此,Web应用程序可以通过http:// localhost:8080 / webApp1 我的nginxconfiguration为proxy_pass如下: location / { http://localhost:8080/webApp1; } 有了这个configuration,networking应用程序应该与url http:// localhost一起工作 这只适用于主页文本。 主页加载成功,但主页上的所有链接都以/ webApp1为前缀,认为它是由自己运行的,因此输出contextpath作为所有链接的前缀。 有没有人解决这个问题。 所有的答案非常感谢。 ž。

Spring Bootconfiguration一个域/主机以www.website.com的方式访问

我有一个春季启动应用程序。 通常,我在PaaS实例上运行我的Spring应用程序,并从中configuration一个域名非常简单,但是我在虚拟专用服务器上运行这个服务,而且在我的生活中,我无法弄清楚如何运行我的spring boot所以可以通过域名访问。 我已经改变了我的DNS设置,所以它指向我的虚拟专用服务器,这个VPS也运行一些其他基于Apache的静态网站,我非常相信我的DNS设置是正确的。 我的spring引导应用程序使用spring-boot-starter-tomcat运行 ,应用程序部署良好,我可以抓住我的.war文件并在服务器上使用java -jar myApplication.jar进行部署。 该应用程序也可以通过在浏览器上编写my.server.ip:8080进行远程访问。 但是,我一直在使用Googlesearch,无法弄清楚如何configurationSpring Boot,以便使用我的域名,这样我就可以以标准的方式访问网站: www.mywebsite.com ,或者更好也添加一个别名,所以mywebsite.com和www.mywebsite.com都是有效的。 任何人都可以指向正确的方向吗? 我知道这可以在Tomcat中完成,但我不知道如何configuration它。 由于这是一个Spring Boot应用程序,我没有.xml文件,所以我的Spring Bootconfiguration位于application-prod.yml文件中,而我使用的唯一.xml文件就是pom.xml本身。 任何帮助将不胜感激。

Apache Tomcat 7 + Nginx – IsTomcat Native需要?

这是我的第一个问题。 如果我犯了错误,只需指出,下次我会改进它。 我是Java开发人员,也是Linux的新手。 我使用Tomcat 7在VPS上部署Spring MVC应用程序,并使用nginx作为代理服务器。 在网上冲浪几天之后,我发现它可能是一个很好的组合,而不是使用tomcat和apache。 我将更多地了解nginx可以做什么。 目前,nginx处理来自客户端的SSL,Tomcat位于同一台计算机中,并作为具有HTTP连接器的后端服务器(Tomcat与Nginx之间没有SSL)。 我也使用limit_req模块作为基本的HTTP Flood防护。 当使用Tomcat作为Web服务器时,我也了解APR – Tomcat本地库。 每当我启动我的tomcat,它说我的APR没有find。 在这种情况下,我需要为Tomcat安装APR lib(nginx + tomcat http连接器)来加速我的服务器吗? 我是有益的使用代理cachingimg,CSS … 谁用这个configuration处理静态文件? 如果tomcat,我们需要安装APR,对吧? 有没有一种方法来保证某些请求模式(如login页面)使用代理时? 我的nginx conf: server { listen 443 ssl; server_name domain; ssl on; ssl_certificate /etc/nginx/ssl/domain.crt; ssl_certificate_key /etc/nginx/ssl/domain.key; location / { proxy_pass http://localhost:8080; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarfed-For $proxy_add_x_forwarded_for; } […]

用Spring Security启用HTTPS:这个网页有一个redirect循环

我正在尝试为Web应用程序的某些页面启用HTTPS。 我使用Spring MVC和Spring Security作为部署在Tomcat上的Web应用程序,使用Nginx作为tomcat的代理。 首先,没有任何HTTPSconfiguration,一切正常。 我生成了一个自签名的SSL证书,并将其安装在Nginx上。 我还没有对Tomcat进行任何更改来启用HTTPS,因为我只是希望Nginx能够处理SSL终止。 这是我有关SSL的Nginxconfiguration。 listen 443; server_name 127.0.0.1; root /usr/local/server/web/webapps/ROOT; ssl on; ssl_certificate /usr/local/etc/nginx/ssl/server.crt; ssl_certificate_key /usr/local/etc/nginx/ssl/server.key; location / { proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; } 我的Spring的SSL安全configuration如下所示: <http pattern="/static/**" security="none" /> <http pattern="/favicon*" security="none" /> <http use-expressions="true"> <intercept-url pattern="/login" access="permitAll" requires-channel="https" /> <intercept-url pattern="/loginprocess" method="POST" requires-channel="https" […]

不能用Nginx(反向代理+ SSL协商)和Tomcat上传大文件

组态: Nginx作为反向代理+ SSL协商 Apache Tomcat。 似乎一切正常,除了file upload。 由于某种原因file upload永远不会完成。 通过下面列出的configuration,我可以上传小文件(4K)。 上传失败的194K文件。 当我将“client_body_buffer_size”增加到256K时,我可以上传194K文件,但是一个500Kfile upload失败。 增加超过256K的“client_body_buffer_size”没有任何影响。 注意:当我直接访问Tomcat并上传500K文件时,它在几毫秒内完成。 所以,Nginxconfiguration看起来有点不对劲。 任何build议,非常感谢。 upstream tomcat_server { server 127.0.0.1:9090 fail_timeout=0; keepalive 16; } location / { root /xyz; proxy_http_version 1.1; proxy_pass http://tomcat_server; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_buffering on; proxy_connect_timeout 75; proxy_send_timeout […]

会话复制不能与tomcat7一起使用

在我的nginx中,我设置了上游并设置粘滞的会话: upstream tomcat { ip_hash; server localhost:XXXX; server localhost:XXXY; server localhost:XXYY; } 我在我的web.xml中添加了<distributable/>标签(在所有的tomcat中) 已经在我的tomcat / conf / server.xml文件中添加了这个: <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6"> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="5000" selectorTimeout="100" maxThreads="6"/> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> </Sender> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".*\.gif|.*\.js|.*\.jpeg|.*\.jpg|.*\.png|.*\.htm|.*\.html|.*\.css|.*\.txt"/> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" […]

nginx的代理服务器上的400错误的请求,而不是静态内容

我们已经遇到了一个问题,当我们的cookie达到一定的规模(超过7K),其中nginx返回400错误的请求与空代理响应代理到我们的tomcat。 但是,当nginx提供静态内容时不会发生这种情况。 我们已经尝试更新nginxconfiguration来增加缓冲区大小,所以它应该处理高达16k的单个头(我们也试图在服务器级别设置它): http { # … client_body_buffer_size 32k; client_header_buffer_size 16k; large_client_header_buffers 4 16k; # … } 我们也把tomcat的max-http-header-size提高到了16k。 如果我们将Cookie大小增加到16k以上,我们仍然会收到400个错误的请求,但是响应的“请求标头或Cookie太大”错误消息。 8k和16k的头大小之间发生了奇怪的事情,我们无法弄清楚。