全网最简单ubuntu18.04+mysql5.7+nginx+uwsgi一次性部署Django!!!!!

ubuntu 18.04 ,自带python3.6,mysql 5.7

 

Nginx*******************************

1. 安装nginx
apt-get update
apt-get upgrade
apt-get install nginx

2. 修改端口为81(可选),是一个链接
/etc/nginx/sites-enabled/default

3.service nginx reload

4.service nginx restart

nginx 配置 /etc/nginx/conf.d 增加配置文件 xxx.conf
注意不能用记事本编辑
# server {
# listen 82;
# server_name 114.14.114.114;
# access_log /var/log/nginx/logindemo_access.log;
# error_log /var/log/nginx/logindemo_error.log;
# charset utf-8;

# client_max_body_size 75M;
# root /data/djangoProject;
# location / {
# include uwsgi_params;
# uwsgi_pass 127.0.0.1:8997;
# uwsgi_param UWSGI_SCRIPT djangoProject.wsgi.wsgi;
# uwsgi_param UWSGI_CHDIR /data/djangoProject/; #项目路径
# }
# location /static/ {
# expires 30d;
# autoindex on;
# add_header Cache-Control private;
# alias /data/djangoProjectstatic/;
# }
# }







Django******************************

1.pip3 install -U pip 升级pip,支持config

2.pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ 更换源

3.pip3 install django==2.2.3



========网络问题严重的话使用下面的命令=========
----------------------------------------------------------------------
* pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple uwsgi *
* *
* ----------------------------------------------------------------------*



uWSGI*********************************

pip3 install uwsgi



# <uwsgi>
# <py-autoreload>1</py-autoreload>
# <socket>127.0.0.1:8997</socket><!-- 内部端口,自定义 -->
# <chdir>/data/djangoProject</chdir><!-- 项目路径,有没有斜杠都一样 -->
# <module>djangoProject.wsgi</module>
# <processes>4</processes> <!-- 进程数 -->
# <daemonize>uwsgi.log</daemonize><!-- 日志文件 -->
# </uwsgi>






MySQL***********************************


https://blog.csdn.net/css33/article/details/93233590

apt-get install mysql-server

mysql -u root -p 登录mysql
use mysql

update mysql.user set authentication_string=PASSWORD('NEW_PASSWORD'),plugin='mysql_native_password' where user='root'; 修改root密码

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'NEW_PASSWORD' WITH GRANT OPTION; 远程登陆


修改 /etc/mysql/mysql.conf.d 找到bind 127.0.0.1,注释掉,
service mysql reload,restart

 

posted @ 2024-09-19 15:34  元気な猫  阅读(34)  评论(1编辑  收藏  举报