linux下nginx+uwsgi部署python应用

nginx的安装和配置:http://blog.csdn.net/cjh6311882/article/details/7693575

1.安装

pip install uwsgi

3.配置

cp nginx/uwsgi_params /usr/local/nginx/conf/
vi /usr/local/nginx/conf/nginx.conf

编辑Nginx配置文件添加,uWSGI监听9090端口:

server {  
	listen 80;  
	root   /var/www/django1.23;  
	index  index.html index.htm;  
	server_name uwsgiadmin.django.obmem.info;  
	access_log  /var/log/nginx/django.access.log;  
	location /media/ {  
		root /var/www/django1.23/adminmedia;  
		rewrite ^/media/(.*)$ /$1 break;  
	}  
	location / {  
		include uwsgi_params;  
		uwsgi_pass 127.0.0.1:9090;  
	}  
}

4.运行命令:

uwsgi --chdir=/data/antispam/code/spam_web --module=spam_web.wsgi:application --env  DJANGO_SETTINGS_MODULE=spam_web.settings --master --socket=127.0.0.1:3400 --daemonize=/data/antispam/code/spam_web/web.log
具体的含义见文档:https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/uwsgi/

这里要注意的是

--module=spam_web.wsgi:application
application不是你的app名字,只是这里恰好是application而已。


你可能感兴趣的:(nginx,linux,python,django,import)