2012-12-04 20 views
0

我一直試圖在我的VPS上設置一個nginx服務器來部署我的Rails應用程序。 一切都已經成功,直到最後的命令,如果我得到這個工作,我將能夠看到我的應用程序在服務器上。設置Rails的Nginx服務器的最後一步

我做

sudo service nginx restart 

最後,

sudo update-rc.d uinicorn_app defaults 

但它說

update-rc.d: /etc/init.d/unicorn_app: file does not exist 

我手動進入目錄檢查的文件,並將該文件在那裏。但是,當我運行下面的命令時,我得到了以下內容。

[email protected]:/$ file /etc/init.d/unicorn_app 
/etc/init.d/unicorn_app: broken symbolic link to `/home/deployer/apps/app/current/config/unicorn_init.sh' 

如何解決此問題並完成設置我的服務器?

更新:好像我deploy.rb配置無法正常工作,因爲我無法找到的/ home /部署/應用/應用/當前文件夾。下面是我的deploy.rb部分:

namespace :deploy do 
    %w[start stop restart].each do |command| 
    desc "#{command} unicorn server" 
    task command, :roles => :app, :except => {:no_release => true} do 
     run "/etc/init.d/unicorn_#{application} #{command}" 
    end 
    end 

    task :setup_config, :roles => :app do 
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}" 
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}" 
    run "mkdir -p #{shared_path}/config" 
    put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml" 
    puts "Now edit the config files in #{shared_path}." 
    end 

任何想法?

+0

是否存在'/ home/deployer/apps/app/current/config/unicorn_init.sh'文件? – bdares

+0

@bdares,apps/app目錄中只有「發佈」和「共享」文件夾。當前文件夾如何不存在? –

+0

原來,我忘了做帽部署:冷 –

回答

1

如果你不能找到當前文件,運行

cap deploy:cold 

將部署應用程序,運行所有未決的遷移,並啓動服務器首次。

相關問題