# day29 **Repository Path**: zz418841988/day29 ## Basic Information - **Project Name**: day29 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-21 - **Last Updated**: 2025-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [uwsgi] 配置 socket = 127.0.0.1:8002 chdir = /data/www/day29/ wsgi-file = app.py callable = app processes = 2 virtualenv = /envs/sbb/ # 关键:开启后台运行并指定日志文件(必须设置) daemonize = /var/log/uwsgi/sbb_uwsgi.log # 记录进程ID,方便后续停止/重启 pidfile = /var/run/sbb_uwsgi.pid #(如果/var/log/uwsgi目录不存在,先创建:sudo mkdir -p /var/log/uwsgi && sudo chown uwsgi:uwsgi /var/log/uwsgi) # 重启 uWSGI: # 此时 uWSGI 会在后台独立运行,关闭 Xshell 连接后进程不会终止,502 错误会消失。 项目初始化,上传远程仓库 cd day29 git init git remote add origin https://gitee.com/zz418841988/day29.git #服务器下载代码 cd /data/www/ #在代码的上级文件夹下 git clone https://gitee.com/zz418841988/day29.git 更新代码在项目文件夹下: cd /data/www/day29/ git pull origin master 虚拟环境统一安装在根目录下的envs文件夹下面.. 创建虚拟环境 virtualenv /envs/sbb --python=python3.9 激活虚拟环境 可以在任意目录下操作 source /envs/sbb/bin/activate 安装uwsgi pip install uwsgi uwsgi配置 激活虚拟环境 source /envs/sbb/bin/activate 进入项目目录 ,启动 uwsg uwsgi --ini sbb_uwsgi.ini - 停止 ps -ef|grep sbb_uwsgi kill -9 15018 Nginx 1.安装 yum install nginx -y 2.配置 - 普通请求 -> 8001端口 - /static/ -> /data/www/day28/static nginx的默认配置文件路径 /etc/nginx/nginx.conf 2.1 删除默认的nginx.conf rm nginx.conf 2.2 新建 nginx.conf + 内容拷贝 + 保存 cd /etc/nginx/ vim nginx.conf 创建并打开文件 i 编辑模式 ESC :wq cat nginx.conf http://43.136.70.18/day29