1.准备
项目架构为:LNM+Python+Django+uwsgi+Redis (L:linux,N:nginx,M:mysql)
将bbs项目压缩上传到: /opt
在shell中直接拖拽
1.1将sql文件导出,传到opt(选择结构和数据)
1.2不要用数字与大写开头的库名,尽量使用小写(字符集选用utf8mb4)
source /opt/bbs/bbs.sql
解压bbs:
unzip bbs.zip
同理导出数据库的文件.不需要压缩,直接上传
2.配置Nginx
[root@web01 BBS]# vim /etc/nginx/conf.d/py.conf server {
listen 80;
server_name 10.0.0.100;
client_max_body_size 100M; location /static {
alias /opt/BBS/static/;
} location /media {
alias /opt/BBS/media;
} location / {
index index.html;
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_param UWSGI_SCRIPT BBS.wsgi;
uwsgi_param UWSGI_CHDIR /opt/BBS;
}
}
3.配置uwsgi
2.1关闭所有已有的uwsgi
kill -9 `ps -ef |grep uwsgi|awk {'print $2'}`
2.2配置文件
[root@web01 BBS]# vim uwsgi.ini [uwsgi]
socket = 127.0.0.1:9090
master = true
workers = 2
reload-mercy = 10
vacuum = true
max-requests = 1000
limit-as = 512
buffer-size = 30000
2.3重启uwsgi
uwsgi --ini uwsgi.ini &
2.在浏览器中输入10.0.0.100即可看到bbs项目首页