物理マシンに基づいてフロントエンドとバックエンドの分離プロジェクトを展開する

ソフトウェアのインストール 

gitをインストールする

mysqlをインストールする

Redisをインストールする

Pythonをインストールする

仮想環境をインストールする

uwsgiをインストールする

nginxをインストールする

Centos は共通ソフトウェアをインストールします_Riding タイフーン ウォーキング ブログ - CSDN ブログmysql のアンインストール### 1 mysql のインストールを表示します rpm -qa |grep -i mysql # -i は大文字を無視することを意味します'''' mysql80-community-release-el7 -7.noarch mysql -community-common-8.0.32-1.el7.x86_64 mysql-community-clie...Centos7 は Mysql5.7 - Mysql8 の 4 つのスキーム - Zhihu をインストールします。https://blog.csdn.net/qq_52385631/article/details/131576514?spm=1001.2014.3001.5501

ステップ

フロントエンドによって送信されたリクエスト URL、8000 に送信されたリクエストは nginx によってキャプチャされて転送されます

http://10.0.0.100:8000/api/v1/banner/s

導入手順

# 本地收集static dist 上传
python manage.py collectstatic
# 拉项目
https://gitee.com/yqmc/t_api.git
# 切换(生成)虚拟环境
workon t_env
# 安装模块
pip3 install -r requirement.txt -i https://pypi.douban.com/simple
pip3 install uwsgi -i https://pypi.douban.com/simple
# uwsgi配置(配置在后面) 在项目根路径
vim t_api.xml
# nginx配置
cp /usr/local/nginx/conf/nginx.conf   /home/back.conf
vim /usr/local/nginx/conf/nginx.conf

t_api.xml

<uwsgi>    
           <socket>127.0.0.1:8888</socket>
           <chdir>/home/t_api</chdir>       
           <module>t_api.wsgi</module>
           <processes>4</processes>
           <daemonize>uwsgi.log</daemonize>
</uwsgi>

 nginx.conf

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    server {
        listen 80;
        server_name  127.0.0.1;
        charset utf-8;
        location / {
            root /home/dist;
            index index.html;
            try_files $uri $uri/ /index.html;
        }
    }
    server {
            listen 8000;
            server_name  127.0.0.1;
            charset utf-8;
            location / {
               include uwsgi_params;
               uwsgi_pass 127.0.0.1:8888;
               uwsgi_param UWSGI_SCRIPT luffy_api.wsgi; 
               uwsgi_param UWSGI_CHDIR /home/project/luffy_api/;
            }
            location /static {
            alias /home/static;
        	}
        }
} 

起動

nginx
uwsgi -x t_api.xml

殺すため

pkill -9 -f nginx
pkill -9 -f uwsgi

フィルター

 ps -aux |grep nginx
 ps -aux |grep uwsgi

おすすめ

転載: blog.csdn.net/qq_52385631/article/details/131646515