加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
start_blog.sh 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
otfsenter 提交于 2018-10-25 00:33 . modify start_blog.sh
#!/usr/bin/bash
yum -y update
yum -y install yum-utils
yum -y groupinstall development
# install python
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum -y install python36u
yum -y install python36u-pip
yum -y install python36u-devel
ln -s /usr/bin/python3.6 /usr/bin/python3
ln -s /usr/bin/pip3.6 /usr/bin/pip3
pip3 install --upgrade pip
pip3 install django
pip3 install uwsgi
# install nginx
cat << EOF > /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/\$basearch/
gpgcheck=0
enabled=1
EOF
yum install -y nginx
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf_backup
cat << EOF > /etc/nginx/conf.d/mysite.conf
# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name $1; # substitute your machine's IP address or FQDN
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
charset utf-8;
gzip on;
gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-php application/json text/json image/jpeg image/gif image/png application/octet-stream;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media/ {
alias /root/code/django_blog/media/; # your Django project's media files - amend as required
}
location /static/ {
alias /root/code/django_blog/static/;
}
# Finally, send all non-media requests to the Django server.
location / {
include uwsgi_params;
uwsgi_connect_timeout 30;
uwsgi_pass unix:/root/code/django_blog/uwsgi.sock;
}
}
EOF
# download django blog
mkdir -p /root/code/
cd /root/code/
git clone https://github.com/otfsenter/django_blog.git
cd /root/code/django_blog
touch uwsgi.log
pip3 install -r requirements.txt
chmod +x -R /root/code
echo "migrate, collectstatic and create superuser"
echo "then start uwsgi and nginx"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化