LoginSignup
1
2

More than 5 years have passed since last update.

さくらVPSでRuby on Rails

Last updated at Posted at 2015-09-01

ど素人の私自身のためのメモです。

①さくらのVPS サーバの初期設定ガイド

【補足】

ログイン


$ ssh root@160.16.122.124

鍵認証

VPSでの鍵の受け入れ

$ mkdir ~/.ssh
$ chmod 700 ~/.ssh

macでの鍵の作成・送信

$ ssh-keygen -t rsa -v
Overwrite (y/n)?  【→ yと入力】
Enter passphrase (empty for no passphrase):   【→ EnterでOK】
Enter same passphrase again:   【→ EnterでOK】

$ chmod 600 ~/.ssh/id_rsa.pub
パーミッションを変える。

$ scp ~/.ssh/id_rsa.pub {ユーザー名}@{IP}:~/.ssh/authorized_keys
$ ssh -i ~/.ssh/id_rsa {ユーザー名}@{IP}
鍵をサーバーに送る。

ファイヤーウォール

# vim /etc/sysconfig/iptables
の中に記述。

iptablesの中に書くために参考になったサイト。

http://qiita.com/shimohiko/items/ec672655edb84578a82e
http://www.さくらvps.com/6.html
http://dotinstall.com/lessons/basic_sakura_vps/8010
http://qiita.com/chkk525@github/items/a62e73d0d57570614ed7

②Rubyなどをインストール

Gitを入れる

Ruby/Ruby on Railsを入れる

③Railsアプリをつくる

rails newする。

turbolinksをオフにする

初心者には扱えない代物なので、さようなら。
http://qiita.com/kazz187/items/12737363d62b9c91993c

Mysql周りのトラブル

壊れた?

socketがない

Access denied for user

④Phusion Passengerを入れる

CentOSの場合はここに記述。
$ sudo vim /etc/httpd/conf/httpd.conf

動いた!

⑤devise

deviseを
$ rake db:migrate RAILS_ENV=production
すると、
NameError: uninitialized constant Devise
が出る。

/xxx/config/initializers/devise.rb

require 'devise'
を追記。

もう一度
$ rake db:migrate RAILS_ENV=production

config.secret_key = 'cccbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
と出力されるので、

/xxx/config/initializers/devise.rb
に追記。

もう一度
$ rake db:migrate RAILS_ENV=production

できた!

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2