我正在部署带有Phusion乘客和Apache HTTPD的Rails应用程序,为此我必须在Apache中创建一个虚拟主机来关联我的应用程序的根目录。这个过程很成功,实际上我的应用程序正在运行,但我的问题是我必须在我的域的路径中运行,例如“mydomain.com/railsapp”。 我尝试了这种配置,但都失败了。**
ServerAdmin admin@mydomain.com
ServerName mydomain.com/railsapp
RailsEnv production
RailsBaseURI /app
DocumentRoot /var/www/rails/app/public
<Directory /var/www/rails/app/public>
AllowOverride all
Options -MultiViews
#Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerAdmin admin@mydomain.com
ServerName mydomain.com
ServerPath /railsappp
RailsEnv production
RailsBaseURI /app
DocumentRoot /var/www/rails/app/public
<Directory /var/www/rails/app/public>
AllowOverride all
Options -MultiViews
#Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerAdmin admin@mydomain.com
ServerName mydomain.com
ServerAlias mydomain.com/railsappp
RailsEnv production
RailsBaseURI /app
DocumentRoot /var/www/rails/app/public
<Directory /var/www/rails/app/public>
AllowOverride all
Options -MultiViews
#Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
有人知道怎么做吗?
答案 0 :(得分:0)
使用ServerName作为我的domain.com并使用ProxyPass和ProxyPassReverse指令将/ railsapp重定向到所需的位置....阅读有关反向代理的更多信息..