gpt4 book ai didi

ruby-on-rails - 如何使用 Apache 和乘客服务 Rails Web 应用程序

转载 作者:行者123 更新时间:2023-12-04 19:20:09 25 4
gpt4 key购买 nike

我正在使用 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>

我在/etc/apache2/apache2.conf 中添加了这些行
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.40/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.40
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
</IfModule>

我做到了
service apache2 restart

但我的网站仍然无法正常工作: http://eurohacktrip.org/够奇怪了 它适用于 3000 http://eurohacktrip.org:3000
我也不得不取消注释
gem 'therubyracer', platforms: :ruby 

跑了
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

关于ruby-on-rails - 如何使用 Apache 和乘客服务 Rails Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22629065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com