2011-10-18 36 views
0

我對我的Rails應用程序做了一些更改,並嘗試使用我的capistrano部署任務推送更改。它運行良好,並通過將restart.txt文件放在應用程序的tmp文件夾中完成。然後我訪問該網站,立即得到一個502錯誤的網關錯誤。我停止了nginx,並嘗試重新啓動。當我這樣做,我只是得到:Phusion乘客nginx壞網關後觸摸tmp/restart.txt

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

當我運行ps ax,幾個nginx的工作進程仍在運行,但我無法想象這將是一個問題。如果有幫助,這是我的部署腳本:

# $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) 

# require 'rvm/capistrano' 
require 'bundler/capistrano' 

# set :rvm_ruby_string, '[email protected]' 
# set :rvm_type, :user 

set :default_environment, { 
    'PATH' => "/home/user/.rvm/gems/ruby-1.9.2-p290/bin:/home/user/.rvm/bin:/home/user/.rvm/ruby-1.9.2-p290/bin:$PATH", 
    'RUBY_VERSION' => 'ruby 1.9.2', 
    'GEM_HOME'  => '/home/user/.rvm/gems/ruby-1.9.2-p290', 
    'GEM_PATH'  => '/home/user/.rvm/gems/ruby-1.9.2-p290', 
    'BUNDLE_PATH' => '/home/user/.rvm/gems/ruby-1.9.2-p290' # If you are using bundler. 
} 

set :application, "StarCraftZen" 
set :repository, "githubrepourl" 
set :user, "user" 
set :scm_username, "user" 
set :use_sudo, false 
default_run_options[:pty] = true 

set :scm, :git 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 

set :deploy_to, "/home/user/app/" 

role :web, "myapp.com"       # Your HTTP server, Apache/etc 
role :app, "myapp.com"       # This may be the same as your `Web` server 
role :db, "myapp.com", :primary => true # This is where Rails migrations will run 

load 'deploy/assets' 

namespace :deploy do 
    #desc "deploy the precompiled assets" 
    #task :deploy_assets, :except => { :no_release => true } do 
    # run "cd #{release_path} && rm -rf public/assets/*" 
    # run "cd #{release_path} && RAILS_ENV=production bundle exec rake assets:precompile" 
    #end 

    desc "Restart nginx" 
    task :restart do 
    run "touch /home/user/app/current/tmp/restart.txt" 
    end 
end 

回答

0

找到另一個帖子最後提到嘗試使用sudo運行netstat命令:

sudo netstat -anltp | grep LISTEN

當時我能夠找到使用PID端口80,並殺死它。這是工人之一。