Ubuntu 12.10 Nginx Rails 3.2.13. Deploy in sub URI. Nothing happens!

113 views
Skip to first unread message

LuisRuby

unread,
Mar 13, 2013, 8:46:20 PM3/13/13
to rubyonra...@googlegroups.com
Dear friends,
I followed the guide on http://techoctave.com/c7/posts/16-how-to-host-a-rails-app-with-phusion-passenger-for-nginx and successfully deployed two apps on the same web server, some months ago.
Then when I upgraded to Rails 2.3.13.rc1 everything seems to be OK, but when I visit my app with the browser all that I get is the Welcome page from Nginx.
Here is my nginx.conf:

worker_processes  4;
http {
    passenger_root /home/luis/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19;
    passenger_ruby /home/luis/.rvm/wrappers/ruby-1.9.3-p392/ruby;

server {
        listen       80;
        server_name  domain.com;
        root /home/lacy/public_html;
        passenger_enabled on;
        passenger_base_uri /myapp1;
location / {
            root   html;
            index  index.html index.htm;  }
error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;  }
}

Here is my deploy.rb:

require "bundler/capistrano"
require "rvm/capistrano"           
set :rvm_ruby_string, :local      

set :domain, 'www.myapp1.domain.com'  
set :application, "myapp1"
set :repository,  "g...@github.com:xxxxxxxx/myapp1.git"
set :branch, "master"

set :scm, "git"     
set :user, "myapp1"   
set :deploy_to, "/home/myapp1/apps/#{application}"
set :deploy_via, :remote_cache
set :copy_strategy, :export

set :use_sudo, false
set :keep_releases, 3

role :web, 'my IP' 
role :app, 'my IP'                        
role :db,  'my IP', :primary => true

set :port, 22

after 'deploy:update_code' do
  run "cd #{release_path}; RAILS_ENV=production rake assets:precompile"
end

# 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

Curiously /opt/nginx/logs/error.log doesn't report anything.
I am fighting with this problem during many days without any solution. I'm very tired and under hard pressure from my client,
Does anybody have a hint, where to look for my mistake?
Thanks in advance!

Luis






Nikolay

unread,
Mar 16, 2013, 7:36:02 AM3/16/13
to rubyonra...@googlegroups.com
Try to create database on server $> rake db:create RAILS_ENV=production

replace this:
root /home/lacy/public_html;
on this
root /home/lacy/your-app-name/current/public;


Remove this:
location / {
            root   html;
            index  index.html index.htm;  }
error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;  }

Dont use 'www'
set :domain, 'www.myapp1.domain.com

Be sure you've added 'domain.com' and 'myapp1.domain.com' in your /etc/hosts file

Make the same
set :deploy_to, " /home/lacy/your-app-name" 
and in your nginx config file
root /home/lacy/your-app-name/current/public;

After changing your nginx.cong file restart nginx 
$> sudo service nginx stop
$> sudo service nginx start
(or $> sudo service nginx reload && sudo service nginx restart)

Reply all
Reply to author
Forward
0 new messages