将 Apache 重定向到 Tomcat

将 Apache 重定向到 Tomcat

我有一台使用 Apache 运行 Rails 和 Tomcat 应用程序的服务器。我目前有一个 Rails 应用程序设置在端口 80 上,一个 Tomcat 应用程序设置在端口 8080 上。我试图让 Apache 将 /uploader 上的所有请求转发到 Tomcat。Tomcat 应用程序在访问其自己的 URL 时工作正常,但使用重定向时,每个请求需要大约 60 秒。这是我的 httpd 文件。任何帮助都非常感谢!谢谢!

<VirtualHost *:80>
  ServerName http://example.com/
  DocumentRoot /Users/lab/WebApplications/app/public   
  PassengerSpawnMethod conservative

    # Speeds up spawn time tremendously -- if your app is compatible. 
    # RMagick seems to be incompatible with smart spawning
    RailsSpawnMethod smart

    # Keep the application instances alive longer. Default is 300 (seconds)
    PassengerPoolIdleTime 1000

    # Keep the spawners alive, which speeds up spawning a new Application
    # listener after a period of inactivity at the expense of memory.
    RailsAppSpawnerIdleTime 0

    # Just in case you're leaking memory, restart a listener 
    # after processing 5000 requests
    PassengerMaxRequests 5000
    # PassengerMaxPoolSize 4
    # PassengerMaxInstancesPerApp 4



 <Directory /Users/lab/WebApplications/app/public>
     AllowOverride all              
Allow from all   
    Options -MultiViews            
  </Directory>
</VirtualHost>


ProxyRequests On
ProxyVia On

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

    # Redirect to tomcat
ProxyPass         /uploader  http://localhost:8080/FileSplit
ProxyPassReverse  /uploader  http://localhost:8080/FileSplit

答案1

只是猜测,但 apache 可能正在等待您的应用超时,然后您才能获取 ProxyPass。尝试将其移至文件顶部,看看是否有区别。

相关内容