使用 capistrano 在 ec2 上部署了 Rails 站点,但它没有显示在浏览器上,这是站点 -> http://passionate4.net/

发布于 2024-12-15 19:11:35 字数 3151 浏览 4 评论 0原文

我正在使用 apache Passenger 来部署 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>

-->这样,当我重新启动 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,  "[email protected]: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

总计 8

lrwxrwxrwx 1 ubuntu ubuntu 46 2011-11-17 19:04 当前-> /var/www/

apps/capi_app/releases/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:~$


I am using apache passenger to deploy rails application.

I have followed each and every step clearly and everything works fine.
No error message in deployment.

But the site doesn't show up on browser.

Here are the files

$ 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>

I also tried to change

$ 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>

--> With this, when i restart apache, I don't get error (/ / / public) doesn't exist, but site still doesn't show up.

@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 file -------------

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,  "[email protected]: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

total 8

lrwxrwxrwx 1 ubuntu ubuntu 46 2011-11-17 19:04 current -> /var/www/

apps/capi_app/releases/20111117190420

drwx-w---- 5 ubuntu ubuntu 4096 2011-11-17 19:04 releases

drwx-w---- 6 ubuntu ubuntu 4096 2011-11-17 09:48 shared

ubuntu@ip-10-166-185-18:~$


如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

偏爱你一生 2024-12-22 19:11:35

我将应用程序放置在这个特定位置 var/www/myapplication。

这解决了错误“不允许符号链接或链接目标不可访问”。我将列出解决此问题所采取的所有步骤。

除此之外,我还将在博客中介绍如何解决首次将 Rails 3.1 部署到 ec2 所涉及的错误。在这里 ->
http://recipe4developer.wordpress.com/2011/11/19/ Correcting-errors-in-first-time-rails-3-1-deployment-to-ec2/

I placed the application at this particular location var/www/myapplication.

This resolved the error "Symbolic link not allowed or link target not accessible". I will put all the steps I took to resolve this issue.

In addition to this i'll also blog on how to resolve errors involved with first time deployment of rails 3.1 to ec2. here ->
http://recipe4developer.wordpress.com/2011/11/19/correcting-errors-in-first-time-rails-3-1-deployment-to-ec2/

黑白记忆 2024-12-22 19:11:35

确保您的虚拟主机位于 /etc/apache2/sites-available 中的某个位置,然后确保将其添加到 apache,方法是使用 a2ensite 命令,或者通过手动将 /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

Make sure that your vhost lives somewhere in /etc/apache2/sites-available, and then make sure to add it to apache, either by using the a2ensite command, or by manually symlinking /etc/apache2/sites-enabled/your_vhost_name_here to whatever you called the site.

Possible commands to enable the site (use either one):

sudo a2ensite your_vhost_name

sudo ln -s /etc/apache2/sites-available/your_vhost_name /etc/apache2/sites-enabled

After you've done this, make sure to reload apache, by running the following command:

sudo service apache2 restart
两个我 2024-12-22 19:11:35

您不使用 Heroku 有什么原因吗?您可以通过非常简单的部署获得 EC2。

Is there a reason you're not using Heroku? You get EC2 with very easy deployment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文