nginx:处理http请求
uwsgi:把nginx和python应用联系起来
flask:是一个python web框架
uwsgi
用 命令:uwsgi —ini xxx.ini 来启动
参考xxx.ini 文件 :
[uwsgi]
socket = 127.0.0.1:5000
chdir = /var/www/html/tipsweb/
wsgi-file = views.py
callable= app
threads = 2
stats = 127.0.0.1:9191
pidfile = uwsgi.pid
daemonize=./log/uwsgi.log
lazy-apps=true
touch-chain-reload=true
注意daemonize=./log/uwsgi.log 排查问题主要手段
关闭 uwsgi 用使命 ps -ef | grep uwsgi 查看 pid 再用 kill -9 pid号码
nginx:
配置:/usr/local/nginx/conf/nginx.conf
参考配置如下:
http {
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr - $remote_user [$time_local] “$request” ‘
# ‘$status $body_bytes_sent “$http_referer” ‘
# ‘“$http_user_agent” “$http_x_forwarded_for”‘;
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;#access_log logs/host.access.log main;location / {<br /> root html;<br /> index index.html index.htm;<br /> include uwsgi_params;<br /> uwsgi_pass 127.0.0.1:5000;<br /> }#error_page 404 /404.html;# redirect server error pages to the static page /50x.html<br /> #<br /> error_page 500 502 503 504 /50x.html;<br /> location = /50x.html {<br /> root html;<br /> }<br /> }<br />}<br />注意标红的两句
