- NGINX Cookbook
- Tim Butler
- 138字
- 2021-07-03 00:04:28
How to do it...
We'll now configure uWSGI to point to our Django project, which for this example I have located at /var/www/djangodemo. Here's the uwsgi.ini file:
[uwsgi] socket = 127.0.0.1:8000 uid=www-data gid=www-data chdir=/var/www/djangodemo module=djangodemo.wsgi master=True pidfile=/tmp/uwsgi-djangodemo.pid vacuum=True max-requests=5000 daemonize=/var/log/uwsgi/djangodemo.log
For this example, we're also using TCP sockets rather than Unix sockets. Although they're slightly more efficient, having a proper socket makes it much easier for the initial testing phase. If you're hitting limitations (many thousands of concurrent connections), then I'd suggest that you use Unix sockets.
Now for the NGINX configuration, we'll use a separate configuration file (/etc/nginx/conf.d/django.conf) to keep things neat and tidy:
server { listen 80; server_name djangodemo.nginxcookbook.com; access_log /var/log/nginx/djangodemo-access.log combined; location = /favicon.ico { access_log off; log_not_found off; } location /static|/media { root /var/www/djangodemo/; } location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8000; } }
推薦閱讀
- Mastering Natural Language Processing with Python
- PHP網(wǎng)絡(luò)編程學(xué)習(xí)筆記
- 單片機(jī)應(yīng)用技術(shù)
- 你必須知道的204個Visual C++開發(fā)問題
- Python貝葉斯分析(第2版)
- bbPress Complete
- Android系統(tǒng)級深入開發(fā)
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- 軟件工程與UML案例解析(第三版)
- 視窗軟件設(shè)計和開發(fā)自動化:可視化D++語言
- Tableau Dashboard Cookbook
- 數(shù)字媒體技術(shù)概論
- 軟件測試項(xiàng)目實(shí)戰(zhàn)之功能測試篇
- Python編程基礎(chǔ)
- Expert Angular