如何让Cuba Platform的应用运行在Apache Http Server后面。

Cuba Platform的文档上介绍了让Cuba Platform的应用运行Nginx Web后面。然而,遗憾的是,它没有介绍如何在Apache Http Server上配置。这是一个我在英文版论坛上问的问题,后来我找到了解决办法。我把解决办法也发一份在中文论坛上,希望能让与我一样遇到这个问题的人少走一点弯路。

环境:
OS: CentOS Linux release 7.8.2003 (Core)
Apache Http server: 2.4.6

<VirtualHost *:80>
  ServerName #IP or Domain#
  ServerAdmin #You email address#

  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}/app/$1

</VirtualHost>

<VirtualHost *:443>
  ServerName #IP or Domain#
  ServerAdmin #You email address#

  SSLEngine on
  SSLCertificateFile #path to public ssl certification file#
  SSLCertificateKeyFile #path to ssl certification's private key file#
  SSLCACertificateFile #path to ssl certification's CA file file#

  ProxyRequests Off

  RemoteIPHeader X-Forwarded-For
  RemoteIPHeader X-Real-IP
  RemoteIPHeader X-Client-IP
  RemoteIPInternalProxy #IP#

  ProxyAddHeaders On

  <Proxy http://localhost:8080>
        Order deny,allow
        Allow from all
  </Proxy>

  <Location /app/ >
        ProxyPass http://localhost:8080/app/
        ProxyPassReverse http://localhost:8080/app/
  </Location>

</VirtualHost>

Reference

3 个赞

你好, @Peter_Liang

非常感谢你的分享!