1. 程式人生 > >使用nginx+uwsgi配置django專案

使用nginx+uwsgi配置django專案

yum install nginx sqlite-devel sqlite zlib-devel -y

cat /etc/nginx/conf.d/py.conf

server {
    listen 80;
    server_name 192.168.1.160;
    index index.html;
    client_max_body_size 100M;

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:8005;
        uwsgi_param UWSGI_SCRIPT BBS.wsgi;
        uwsgi_param UWSGI_CHDIR /code/BBS;
    }
}

解壓python檔案

tar -xvf Python-3.6.8.tar.xz

cd /opt/Python-3.6.8

./configure --prefix=/opt/python-3-6-8/

make && make install

配置python 環境變數

vim /etc/profile

export PYTHON_HOME=/opt/python-3-6-8
export PATH=$PYTHON_HOME/bin:$PATH

source /etc/profile