- 安裝環境
add-apt-repository ppa:stevecrozz/ppa
apt-get update
apt-get install uwsgi
- 配置web.py
app = web.application(urls, globals())
application = app.wsgifunc()
- 配置nginx
server {
listen 80;
server_name localhost;
...
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
}
location /static/ {
root D:\Projects\PYTHON\webpy\nginxdemo;
if (-f $request_filename) {
rewrite ^/static/(.*)$ /static/$1 break;
}
}
...
}
- 啓動web.py
uwsgi -s :9090 -w myapp -p 4 #併發4個線程:
- 啓動nginx
> service nginx start
> service nginx stop
> service nginx reload