我有一个 apache/RoR 服务器在 8080 端口上运行,redbird 从端口 80 转发(因为我有一个 nodejs 网站在同一台机器上运行)。问题是当我尝试从 http 连接我的 RoR 网站时,它给了我 500 错误或 GET 失败。下面是我的 apache 设置。
<VirtualHost *:8080>
DocumentRoot /home/ffit/gsatech/production/current/public
ServerName cobranca.gsatech.com.br
ServerAlias www.cobranca.gsatech.com.br
RailsEnv production
<Directory "/home/ffit/gsatech/production/current/public">
#Options -MultiViews
#Allow from all
Options Indexes FollowSymLinks
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error-gsatech-production.log
CustomLog ${APACHE_LOG_DIR}/access-gsatech-production.log combined
PassengerRuby /usr/share/rvm/gems/ruby-2.1.5/wrappers/ruby
LoadModule passenger_module /usr/share/rvm/gems/ruby-2.1.5/gems/passenger-5.1.8/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/share/rvm/gems/ruby-2.1.5/gems/passenger-5.1.8
PassengerDefaultRuby /usr/share/rvm/gems/ruby-2.1.5/wrappers/ruby
</IfModule>
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =cobranca.gsatech.com.br
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
RewriteEngine on
RewriteCond %{SERVER_NAME} =cobranca.gsatech.com.br [OR]
RewriteCond %{SERVER_NAME} =www.cobranca.gsatech.com.br
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
这是我的 app.js,用于将我的 redbird 转发到 apache。
var proxy = require('redbird')({port: 80, xfwd: false});
proxy.register("dicoop.ffit.com.br", "http://dicoop.ffit.com.br:3030");
proxy.register("http://cobranca.gsatech.com.br", "https://cobranca.gsatech.com.br:8080");
proxy.register("www.cobranca.gsatech.com.br", "https://cobranca.gsatech.com.br:8080");
Apache 运行端口 81,而我的 Redbird 模块在端口 80 上运行以通过我的网站进行路由,我让 certbot 为我的 RoR 网站做我的 https 证书。