標籤:python django uwsgi nginx 執行個體
執行個體:192.168.200.133
1.安裝django
wget https://www.djangoproject.com/download/1.7.11/tarball/
1.3.安裝
cd Django-1.x.ysudo python setup.py install
1.4.建立
django-admin.py startproject testdj
1.5.啟動測試
cd testdj # 切換到我們建立的項目
python manage.py runserver
2.安裝 uwsgi
wget https://projects.unbit.it/downloads/uwsgi-2.0.14.tar.gz
tar xvf uwsgi-2.0.14.tar.gz
cd uwsgi
make
報錯: plugins/python/uwsgi_python.h:2:20: error: Python.h: No such file or directory
yum install python-devel ###再make 編譯通過
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" border="0" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/8B/B3/wKioL1hWcEqTlHtOAAIedsV6Pn0432.jpg" title="1.jpg" alt="wKioL1hWcEqTlHtOAAIedsV6Pn0432.jpg" />
3.配置nginx
server{
listen 80;
server_name localhost;
location / {
uwsgi_pass 127.0.0.1:9090;
include uwsgi_params;
uwsgi_param UWSGI_CHDIR /data/www/OMserverweb;
uwsgi_param UWSGI_SCRIPT django_wsgi;
access_log off;
}
location ^~ /static{
root /data/www/OMserverweb/OMserverweb;
}
location ~* ^.+.(mpg|avi|mp3|swf|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mid|midi|wav|rtf|mpeg)$ {
root /data/www/OMserverweb/OMserverweb/static;
access_log off;
}
}
cd /data/www/
ls
django-admin.py startproject OMserverweb
4配置nginx uwsgi.ini
cat /usr/local/nginx/conf/uwsgi.ini
[uwsgi]
socket = 0.0.0.0:9090
master = true
pidfile = /var/run/uwsgi.pid
processes = 8
chdir = /data/www/OMserverweb
pythonpath = /data/www/
profiler = true
memory-report=true
enable-threads=true
logdate=true
limit-as=6048
daemonize=/data/nginx/logs/django.log
5.啟動
|
# uwsgi --ini /usr/local/nginx/conf/uwsgi.ini # /usr/local/nginx/sbin/nginx -t /usr/local/nginx/sbin/nginx 650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" border="0" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" /> 650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" border="0" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/8B/B7/wKiom1hWcGrQSPPDAASzqIX-Elo257.jpg" style="float:none;" title="22.jpg" alt="wKiom1hWcGrQSPPDAASzqIX-Elo257.jpg" />
650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/8B/B3/wKioL1hWcGuBUMDYAAE7C9OLiX8435.jpg" style="float:none;" title="333.jpg" alt="wKioL1hWcGuBUMDYAAE7C9OLiX8435.jpg" /> 至此,配置結束,測試成功;謝謝;
|
本文出自 “好先生2020” 部落格,請務必保留此出處http://fuyuan2016.blog.51cto.com/8678344/1883785
python django uwsgi nginx 執行個體