LoginSignup
16
19

More than 5 years have passed since last update.

nginxとunicornとmysqlのよく使う基本コマンド

Last updated at Posted at 2019-02-11

度々忘れちゃうので、メモがてら。

nginx

・インストール
sudo yum install nginx
・起動
sudo nginx
・停止
sudo nginx -s stop
・再起動
sudo nginx -s reload
〜メインの設定ファイル〜
/etc/nginx/
〜サーバー毎の設定ファイル〜
/etc/nginx/conf.d/
(アプリ名.confという名前で設定ファイル作成)

unicorn

・起動
bundle exec unicorn -E production -c config/unicorn.rb -D
(-Eは環境、-cは設定ファイルの位置、 -Dはデーモン化)
・起動済みのPID確認
ps -ef | grep unicorn | grep -v grep
・停止
kill -QUIT `cat /path/to/unicorn.pid`
(kill [PID番号]でも可)
・再起動
kill -HUP `cat /path/to/unicorn.pid`
・緩やかな再起動
kill -USR2 `cat /path/to/unicorn.pid`

MySQL(多いので詳細はこちら参照)

・ログイン
mysql -u [ユーザー名]
(mysql -u root -p が初期設定)
・ログイン状態から抜ける
quit
・起動
sudo service mysqld start
・停止
sudo service mysqld stop
・再起動
sudo service mysqld restart

※随時更新

16
19
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
16
19