LoginSignup
0
3

More than 3 years have passed since last update.

gunicornを動かしたい(ubuntu+nginx+django+gunicorn)

Last updated at Posted at 2019-10-07

gunicornを使ってみたい。
サーバ周りの知識が足りないため、公式サイトやQiitaやブログの記事を参考に進めてみるも、なかなか上手くいかなかった。
なんとかvagrantでgunicornを設定して表示できるようになったので、メモ。

「gunicornというアプケーションサーバ(wsgiサーバ)を、ubuntu 18.04のsystemdのunitで自動で起動して動作するようにしたい。」

以下のサイトが参考になった。(今回はDBの設定は飛ばした)
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04

※以下の部分は、エラーがでた。

$ gunicorn --bind 0.0.0.0:8000 myproject.wsgi
↓
$ cd .. && gunicorn --bind 0.0.0.0:8000 myproject.wsgi 

参考:
https://codeday.me/jp/qa/20190301/343639.html

上記を参考に、gunicorn.seviceファイルのWorkingDirectoryのパスはdjangoのsettings.pyのあるディレクトリに設定する。

時間ができたら、手順をまとめたい。。


さらに知識を深めるためのメモ

Linux女子部 systemd徹底入門
https://www.slideshare.net/enakai/linux-27872553

systemd サービスユニット覚書
https://qiita.com/ch7821/items/369090459769c603bb6b

Systemd入門(1) - Unitの概念を理解する
http://enakai00.hatenablog.com/entry/20130914/1379146157

いまさらだけどsystemdに入門した
http://yukiyan.hatenablog.jp/entry/2015/10/18/190639

調べなきゃ寝れない!と調べたら余計に寝れなくなったソケットの話
https://qiita.com/kuni-nakaji/items/d11219e4ad7c74ece748


わかりやすかったけど今の理解力では、うまくいかなかった。。。

Deploying Gunicorn systemd
http://docs.gunicorn.org/en/stable/deploy.html#systemd

nginxとgunicornでDjangoの本番環境を構築する(2018年9月最新版)
https://qiita.com/takehiro_t59/items/bf4af2da35a4281f403f

0
3
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
0
3