Nginx+uWSGI+bottle 在Linux上部署
在/data/lujianxing/bottle 文件夹中创建三个文件:
bottle.py bottle的源文件
a.py
from bottle import Bottle, run mybottle = Bottle() @mybottle.route('/') def index(): return 'default_app' application=mybottle
uwsgi.xml
<uwsgi> <socket>0.0.0.0:10005</socket> <listen>20</listen> <master>true</master> <pidfile>/usr/local/nginx/uwsgi.pid</pidfile> <processes>8</processes> <module>a</module> <pythonpath>/data/lujianxing/bottle/</pythonpath> <profiler>true</profiler> <enable-threads>true</enable-threads> <logdate>true</logdate> </uwsgi>
通过命令 uwsgi -x uwsgi.xml 启动服务
nginx配置:
server {
listen 10015;
server_name test.com;
access_log /tmp/log;
error_log /tmp/log1;
location / {
uwsgi_pass 127.0.0.1:10005;
include uwsgi_params;
}
}