1 development environment and usage tools
Environment: centos6.4
Use tool: Gunicorn Nginx
2 First Test your own code permissions and so on there is no problem, I put it in the root directory, the result is error 404 errors
python3.4 manage.py Runserver 0.0.0.0:8020
Then go to the browser input IP or domain name +: 8020 See if you can see the information, this step to exclude their own code problems, generally no problem
Yum -y install nginxmv /etc/nginx/conf/nginx.conf /etc/nginx/conf/nginx.conf.bakcat /etc/nginx/conf/nginx.confuser nobody; #这句是为了安全当然你也可以不加events { worker_ connections 1024;} http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream django { server 127.0.0.1:8020; } server { listen 80; server_name you_server_domain; charset utf-8; client_max_body_size 75m; location / { proxy_pass http://127.0.0.1:8020; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote _addr; proxy_set_header X-Forward-For $proxy _add_x_forwarded_for; } location /static/ { root /root/liuliancao/mysite/; #我存放图片和css等的位置 } }} The permissions for my folder are that it's not going to be a little X (Liuliancao) [[email Protected] mysite]# ll -d /rootdr-xr-x--x. 8 root root 4096 12 Month 20 12:21 /root
On the internet there are many ways to write, you can configure the success of the self-configuration
If the above is done, too.
Then join Gunicorn.
Gunicorn plainly is to help you perform python3.4 manage.py runserver, but the speed and efficiency of execution is better
Installing gunicornpip3.4 install Gunicorncd/root/liuliancao/mysitegunicorn mysite.wsgi:application-b 0.0.0.0:8020
Finally try to get Gunicorn backstage to execute this command
Nohup Gunicorn mysite.wsgi:application-b 0.0.0.0:8030 &>/tmp/gunicorn/liuliancao.com.gunicorn.log
How to break it down, just kill the process.
Jobs View current Job
jobs[2]+ Running gunicorn mysite.wsgi:application-b 0.0.0.0:8030 &
Turn this job off.
FG 2gunicorn mysite.wsgi:application-b 0.0.0.0:8030^c[2015-12-20 21:43:17 +0800] [3591] [INFO] Handling signal:int[2015 -12-20 21:43:17 +0800] [3594] [info] Worker exiting (pid:3594) [2015-12-20 21:43:17 +0800] [3591] [info] shutting Down:ma Ster
At this point, the Django deployment is complete
This article is from the "Learning Path of Kai Learning" blog, please make sure to keep this source http://qixue.blog.51cto.com/7213178/1726628
Deploying Nginx+django