-
安装uwsgi
yum install python-devel pip install uWSGI -
使用uwsgi启动flask项目
uwsgi --http 0.0.0.0:59001 --socket 0.0.0.0:59003 --chdir /server -w manage:app --master --processes 2 --threads 2 --harakiri 180 --buffer-size 32768 --http-time 180 -
安装nginx
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel wget http://nginx.org/download/nginx-1.14.2.tar.gz tar zxvf nginx-1.14.2.tar.gz cd nginx-1.14.2/ ./configure make && make install -
使用nginx部署
user root; worker_processes auto; error_log /tmp/logs/nginx.log; pid /tmp/logs/nginx.pid; events { worker_connections 1024; } http { include /usr/local/nginx/conf/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"'; sendfile on; keepalive_timeout 65; upstream backend { server xxx.xxx.xxx.xxx max_fails=2 fail_timeout=30s; server xxx.xxx.xxx.xxx max_fails=2 fail_timeout=30s; } server { listen 8080; server_name 127.0.0.1; location / { include /usr/local/nginx/conf/uwsgi_params; uwsgi_pass backend; } } }
nginx uwsgi flask项目部署
最新推荐文章于 2025-08-06 22:20:32 发布
本文详细介绍了如何在Linux环境中通过yum和pip安装uwsgi和nginx,然后使用uwsgi启动Flask项目,并配置nginx进行反向代理,实现Web服务的部署。教程涵盖了从安装到配置的全过程。
9418

被折叠的 条评论
为什么被折叠?



