Ruby on rails 如何使用Apache和Passenger为Rails Web应用程序提供服务

Ruby on rails 如何使用Apache和Passenger为Rails Web应用程序提供服务,ruby-on-rails,ruby,apache,ubuntu,Ruby On Rails,Ruby,Apache,Ubuntu,我正在使用ubuntu12.04和apache2在digitalocean vps上为eurohacktrip.org服务 这是我的apache虚拟主机文件:/etc/apache2/sites available/eurohacktrip.org <VirtualHost *:80> ServerName eurohacktrip.org ServerAlias eurohacktrip.org DocumentRoot /var/www/eurohack

我正在使用ubuntu12.04和apache2在digitalocean vps上为eurohacktrip.org服务

这是我的apache虚拟主机文件:/etc/apache2/sites available/eurohacktrip.org

<VirtualHost *:80>
    ServerName eurohacktrip.org
    ServerAlias eurohacktrip.org

    DocumentRoot /var/www/eurohacktrip.org/public

    RailsEnv production
    PassengerEnabled on
    PassengerAppRoot /var/www/eurohacktrip.org/
    PassengerRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
    ServerAdmin webmaster@eurohacktrip.org

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/eurohacktrip.org/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            # Order allow,deny
            Allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
但我的网站仍然不起作用:
http://eurohacktrip.org/

奇怪的是,它在3000上工作
http://eurohacktrip.org:3000

我还不得不取消注释

gem 'therubyracer', platforms: :ruby 
然后跑

bundle install

但还是没有运气。可能缺少什么?

原来我根本没有阅读乘客错误页面上的说明。我只需要禁用一个gem“简单验证码”,运行bundle安装,一切都恢复正常。感谢

根据您的距离,我会考虑使用数字海洋的预先构建的NGIX/UngRunn服务器,而不是手动设置Apache/AuthReIT应该只是在方框中工作。看起来乘客是在单机模式下运行的,在这种情况下,端口号可以用<代码> -端口< /代码>选项来指定。
 LoadModule passenger_module /home/deployer/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.40/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /home/deployer/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.40
     PassengerDefaultRuby /home/deployer/.rvm/gems/ruby-1.8.7-p374/wrappers/ruby
   </IfModule>
        <VirtualHost *:80>
              ServerName yourservername
              RailsEnv production
              # !!! Be sure to point DocumentRoot to 'public'!
              DocumentRoot /home/user/apps/projects/myapp/public
              <Directory /home/user/apps/projects/myapp/public>
                 # This relaxes Apache security settings.
                 AllowOverride all
                 # MultiViews must be turned off.
                 Options -MultiViews
              </Directory>
        </VirtualHost>
bundle install
 LoadModule passenger_module /home/deployer/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.40/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /home/deployer/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.40
     PassengerDefaultRuby /home/deployer/.rvm/gems/ruby-1.8.7-p374/wrappers/ruby
   </IfModule>
        <VirtualHost *:80>
              ServerName yourservername
              RailsEnv production
              # !!! Be sure to point DocumentRoot to 'public'!
              DocumentRoot /home/user/apps/projects/myapp/public
              <Directory /home/user/apps/projects/myapp/public>
                 # This relaxes Apache security settings.
                 AllowOverride all
                 # MultiViews must be turned off.
                 Options -MultiViews
              </Directory>
        </VirtualHost>
http://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger