[メモ] Nginx + Gunicorn の設定 (rhel)
前置き
自分のメモ
usキーボードの日本語切り替えが面倒くさいの自分英語で書きます。
気が向いたら日本語に直します。
Nginx install latest version
Installation
Note: http://nginx.org/en/linux_packages.html#RHEL-CentOS
Install yum-utils
yum install yum-utils
Set up repository (/etc/yum.repos.d/nginx.repo)
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
To install nginx
yum install nginx
Configuration
.conf file
/etc/nginx/conf.d/foo.conf
server {
listen 80;
server_name foobar;
# Read static files by nginx
location /static {
alias /usr/share/nginx/html/static;
}
location / {
proxy_pass http://127.0.0.1:8000/;
}
}
service command
systemctl start nginx
Python
someday
Gunicorn
Installation
pip install gunicorn
Configuration
/etc/foo/settings.py
wsgi_app = config.wsgi:application
chdir = '/etc/foo/bar'
daemon = False
bind = '127.0.0.1:8000'
workers = 3
timeout = 300
# worker_class = 'gevent'
capture_output = True
accesslog = '/var/log/gunicorn/access.log'
errorlog = '/var/log/gunicorn/error.log'
gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=root
Group=root
WorkingDirectory=/etc/foo/bar
ExecStart=/etc/foo/env/bin/gunicorn \
--config /etc/foo/setting.py
[Install]
WantedBy=multi-user.target
service command
systemctl start gunicorn
Author And Source
この問題について([メモ] Nginx + Gunicorn の設定 (rhel)), 我々は、より多くの情報をここで見つけました https://qiita.com/fkeikaf/items/b91ddbe6b812f4f051a6著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .