Always use Python manage. run the project code in Py mode. Because http api interface is involved, you need to use nginx + uwsgi proxy to access the project ...... I don't know about this thing, but I was shocked. The heart of the crash was all ........
Version:
Nginx: 1.2.1
Uwsgi: 1.9.20
DJANGO: 1.6.4
Project Directory:/var/www/OMS
Project app Directory:/var/www/OMS/asset
Uwsgi configuration file directory:/var/www/OMS/uwsgi
1. The project directory is correctly placed, otherwise there will be no headers for various events
/Var/www/OMS
// Because the ini configuration file is used, there is a chdir configuration in the configuration file. If an error is reported at the beginning, the chdir permission is denied. After checking the configuration file, it indicates that the execution permission is not granted, chmo-R + X is required, but it is not good. Someone recommended to put it in the/var/WWW and/home/xxx directories. Then I chose to put it in/var/www, previously stored in/opt/WWW
2. Configure uwsgi using the ini configuration file
CAT/var/www/OMS/uwsgi. ini
[Uwsgi]
Chdir =/var/www/OMS // project directory
Module = OMS. wsgi: Application // The loaded wsgi module. Use the default
Master = true // enable master Process
Pidfile =/var/run/OMS. PID // PID File Location
Vacuum = true // The General files and socket are automatically cleared when the server exits.
Max-Requests = 5000 // maximum request
Daemonize =/opt/log/uwsgi/OMS. Log // output location of the background running log
Socket =: 9090 // listens to the global port 9090. You can change it to socket to run it quickly !~
After the preceding configuration, the nginx vhost configuration file is left.
3. Configure nginx and proxy uwsgi
CAT/usr/local/nginx/CONF/vhost/OMS. conf
Server
{
Listen 10086;
SERVER_NAME x. x;
Location/static /{
Root/var/www/OMS;
}
Location /{
Root/var/www/OMS;
Include uwsgi_params;
Uwsgi_pass 127.0.0.1: 9090;
}
Access_log/opt/log/nginx/OMS. log;
}
Start nginx:/etc/init. d/nginx start; Ensure nginx is correct
4. Start uwsgi
CAT/etc/init. d/uwsgi
#! /Bin/bash
PID =/var/run/OMS. PID
Log =/opt/log/uwsgi
Conf =/var/www/OMS/uwsgi. ini
Case "$1" in
Start)
Echo "Starting uwsgi"
Uwsgi -- ini $ conf -- uid 501 &>/dev/null
;;
Stop)
Echo "Stopping uwsgi"
Killall-Quit uwsgi &>/dev/null
;;
Restart)
$0 stop
Sleep 1
$0 start
;;
*)
Echo "Usage: $0 {START | stop | restart }"
Esac
Exit 0
/Etc/init. d/uwsgi start
CAT/opt/log/uwsgi/OMS. log to check for errors
PS-Ef | grep uwsgi, whether the startup is successful
Finally directly accessible, http://X.X.X.X: 10086
This article from the "bin" blog, please be sure to keep this source http://binbin158.blog.51cto.com/2659767/1569298
Deployment of Django + nginx + uwsgi