- NGINX Cookbook
- Tim Butler
- 135字
- 2021-07-03 00:04:30
How to do it...
- First up, we set up our uwsgi.ini file, which should be located in the root of your Flask application. Here's the file:
[uwsgi]
socket = 127.0.0.1:8000
uid = www-data gid = www-data
chdir = /var/www/flaskdemo
module = demoapp
callable = application
master = True
pidfile = /tmp/uwsgi-flaskdemo.pid
max-requests = 5000
daemonize = /var/log/uwsgi/flaskdemo.log
For this demo, we have a single Flask file located in /var/www/flaskdemo/demoapp.py.
You can quickly launch your uWSGI service by running the following command:
uwsgi --ini uwsgi.ini
- We now need to configure the NGINX server block directive and again I've included this in a separate file (/etc/nginx/conf.d/flask.conf):
server {
listen 80;
server_name flaskdemo.nginxcookbook.com;
access_log /var/log/nginx/flaskdemo-access.log combined;
location = /favicon.ico { access_log off; log_not_found off; }
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_param SCRIPT_NAME '';
}
}
推薦閱讀
- 多媒體CAI課件設(shè)計(jì)與制作導(dǎo)論(第二版)
- Magento 2 Development Cookbook
- Nginx Essentials
- Hands-On RESTful Web Services with Go
- Effective Python Penetration Testing
- SQL經(jīng)典實(shí)例(第2版)
- Web Development with MongoDB and Node(Third Edition)
- Learning OpenStack Networking(Neutron)
- Android系統(tǒng)級(jí)深入開發(fā)
- Python3.5從零開始學(xué)
- Visualforce Developer’s guide
- 從程序員角度學(xué)習(xí)數(shù)據(jù)庫技術(shù)(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- Java并發(fā)編程:核心方法與框架
- C語言程序設(shè)計(jì)
- MySQL數(shù)據(jù)庫應(yīng)用實(shí)戰(zhàn)教程(慕課版)