Nginx + bottle.py + uwsgi 简单配置

pylist 202

Nginx + bottle.py + uwsgi 简单配置

from bottle import run, default_app

@route('/')
def home():
    return "I am running under nginx and uwsgi!"

if __name__ == "__main__":
    run(host='0.0.0.0', port=8080)
else:
    application = default_app()

uwsgi 运行参数

uwsgi -s /var/run/uwsgi/app.sock -d /var/log/app/uwsgi.log -M --chdir /var/www/app

Nginx configuration

server {
     listen 80;
     server_name domain.com;
     access_log /var/log/app/access.log;
     error_log /var/log/app/error.log;
     root /var/www/app;
 
     location / {
         include uwsgi_params;
         uwsgi_pass unix:/var/run/uwsgi/app.sock;
         uwsgi_param UWSGI_CHIDIR /var/www/app;
         uwsgi_param UWSGI_SCRIPT app; # this is app.py with suffix
     }
}
登录发表评论