【发布时间】:2014-02-02 21:01:50
【问题描述】:
我正在进行 Ruby 应用程序的本地开发,并希望设置生产和开发环境。我打算像登台服务器一样在本地使用生产,向我的客户展示代码库的当前状态。但是,我想运行一个具有不同设置的实际开发环境供我个人使用。
我打算使用虚拟主机来区分这两个站点。无论我如何尝试更改 Apache + Passenger 中的设置,它们都在相同的环境中运行(无论是生产环境还是开发环境)。如何让不同的虚拟主机在不同的环境中运行相同的代码库?
/etc/apache2/sites-available/app.conf:
<VirtualHost *:80>
ServerName app.local
ServerAlias app.example.com
DocumentRoot /code/sites/app/public
RailsEnv production
RackEnv production
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
LogLevel debug ssl:debug
ErrorLog ${APACHE_LOG_DIR}/app.error.log
CustomLog ${APACHE_LOG_DIR}/app.access.log combined
</VirtualHost>
/etc/apache2/sites-available/app-dev.conf:
<VirtualHost *:80>
ServerName app.dev.local
DocumentRoot /code/sites/app_dev/public
RailsEnv development
RackEnv development
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
LogLevel debug ssl:debug
ErrorLog ${APACHE_LOG_DIR}/app-dev.error.log
CustomLog ${APACHE_LOG_DIR}/app-dev.access.log combined
</VirtualHost>
【问题讨论】:
标签: ruby-on-rails apache2 passenger