我正在使用apache乘客来部署rails应用程序。
我已经清楚地遵循了每一步,一切正常。 部署中没有错误消息。
但该网站没有显示在浏览器上。
以下是文件
$ sudo cat /etc/apache2/sites-available/capi_app
<VirtualHost *:80>
ServerName www.passionate4.net
DocumentRoot /var/www/apps/capi_app/public
RailsEnv production
<Directory /var/www/apps/capi_app/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
我也试图改变
$ sudo cat / etc / apache2 / sites-available / capi_app
<VirtualHost *:80>
ServerName www.passionate4.net
DocumentRoot /var/www/apps/capi_app/current/public
RailsEnv production
<Directory /var/www/apps/capi_app/current/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
- &GT;有了这个,当我重新启动apache时,我没有得到错误(/ / / public)不存在,但站点仍然没有显示。
@Martin
$ sudo cat / etc / apache2 / sites-enabled / capi_app
<VirtualHost *:80>
ServerName www.passionate4.net
DocumentRoot /var/www/apps/capi_app/current/public
RailsEnv production
<Directory /var/www/apps/capi_app/current/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
----------- deploy.rb文件-------------
require 'bundler/capistrano'
#using RVM!
$:.unshift("#{ENV["HOME"]}/.rvm/lib")
require "rvm/capistrano"
set :rvm_type, :user
set :application, "capi_app"
set :deploy_to, "/var/www/#{application}"
role :web, "50.18.155.154" # Your HTTP server, Apache/etc
role :app, "50.18.155.154" # This may be the same as your `Web` server
role :db, "50.18.155.154", :primary => true # This is where Rails migrations will run
default_run_options[:pty] = true
set :repository, "git@github.com:jaipratik/capi_app.git"
set :scm, :git
set :branch, "master"
set :user, "ubuntu" #if error use whats shown in podcast
set :use_sudo, false
set :admin_runner, "ubuntu"
set :rails_env, 'production' #<<<<<<<<<< NEW
#set :use_sudo, false #if error delete this
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
ubuntu @ ip-10-166-185-18:〜$ ls -l / var / www / apps / capi_app
总共8lrwxrwxrwx 1 ubuntu ubuntu 46 2011-11-17 19:04 current - &gt;的/ var / WWW /
应用/ capi_app /释放/ 20111117190420
drwx-w ---- 5 ubuntu ubuntu 4096 2011-11-17 19:04发布
drwx-w ---- 6 ubuntu ubuntu 4096 2011-11-17 09:48分享
的ubuntu @ IP-10-166-185-18:〜$
答案 0 :(得分:1)
我将应用程序放在这个特定的位置var / www / myapplication。
这解决了错误“不允许符号链接或链接目标无法访问”的错误。我将采取我采取的所有步骤来解决这个问题。
除此之外,我还将讨论如何解决第一次将rails 3.1部署到ec2所涉及的错误。这里 - &gt;
http://recipe4developer.wordpress.com/2011/11/19/correcting-errors-in-first-time-rails-3-1-deployment-to-ec2/
答案 1 :(得分:0)
确保您的vhost位于/etc/apache2/sites-available
中的某个位置,然后确保使用a2ensite
命令将其添加到apache,或者通过手动将/etc/apache2/sites-enabled/your_vhost_name_here
符号链接到任何您称这个网站。
启用站点的可能命令(使用其中一个):
sudo a2ensite your_vhost_name
sudo ln -s /etc/apache2/sites-available/your_vhost_name /etc/apache2/sites-enabled
完成此操作后,请确保通过运行以下命令重新加载apache:
sudo service apache2 restart
答案 2 :(得分:0)
你有没有理由不使用Heroku?您可以通过非常轻松的部署获得EC2。