# 一.基础介绍

# 1.代码地址

代码地址 (opens new window)

# 2.目录

#新建目录
mkdir -p /kwan/blog

#进入目录
cd /kwan/blog

#拉代码
git clone https://gitcode.net/qyj19920704/blog.git
1
2
3
4
5
6
7
8

# 3.启动脚本

#启动脚本,内容在部署脚本中
touch startup-blog.sh
1
2

# 二.部署脚本

# 1.初次部署

echo `ps -ef | grep /kwan/blog/blog/node_modules | grep -v grep | awk '{print $2}'`
kill -9  `ps -ef | grep /kwan/blog/blog/node_modules | grep -v grep | awk '{print $2}'`
cd /kwan/blog
rm -rf blog
git clone https://gitcode.net/qyj19920704/blog.git
cd /kwan/blog/blog
npm install --no-audit
export NODE_OPTIONS=--openssl-legacy-provider
nohup  npm run docs:dev >/dev/null 2>&1 & exit
1
2
3
4
5
6
7
8
9

# 2.优化后

echo `ps -ef | grep /kwan/blog/blog/node_modules | grep -v grep | awk '{print $2}'`
kill -9  `ps -ef | grep /kwan/blog/blog/node_modules | grep -v grep | awk '{print $2}'`
cd /kwan/blog/blog
git config pull.rebase false
git pull
npm install --no-audit
export NODE_OPTIONS=--openssl-legacy-provider
nohup  npm run docs:dev >/dev/null 2>&1 & exit
1
2
3
4
5
6
7
8

# 3.第三方脚本

echo `ps -ef | grep /home/app/belle_blog/node_modules | grep -v grep | awk '{print $2}'`
kill -9  `ps -ef | grep /home/app/belle_blog/node_modules | grep -v grep | awk '{print $2}'`
cd /home/app/belle_blog
git config pull.rebase false
git pull
npm install --no-audit
nohup  npm run docs:dev >/dev/null 2>&1 & exit
1
2
3
4
5
6
7
10.250.34.10:8081
1

# 三.nginx 配置

# 1.安装 nginx

见 nginx 的整理中的 nginx 的安装

# 2.配置

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    upstream open-api-blog{
     server 127.0.0.1:8080;
    }
    server {
        listen       80;
	    server_name  www.qinyingjie.top;
        root         /usr/share/nginx/html;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
	       root   html;
    	       index  index.html index.htm;
	       proxy_pass http://127.0.0.1:8080/;
       	}

	    location ~ .*\.(gif|jpg|jpeg|png|jfif|webp)$ {
	         root  /kwan/;
                 autoindex    on ;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

# 3.常用命令

#启动nginx
systemctl start nginx

#停止 nginx
systemctl stop nginx

#重启 nginx
systemctl restart nginx
1
2
3
4
5
6
7
8

# 四.图片

# 1.代码地址

代码地址 (opens new window)

# 2.服务器存储

#进入目录
/kwan/blogImg
1
2

# 3.typora 配置

image-20230814172359072

# 4.pic 配置

Gbolg
/Users/qinyingjie/Documents/typora/blog_upload.json
1
2

image-20230814172532098

image-20230814172454361

blog_upload.json

{
  "Gbolg": {
    "url": "https://www.qinyingjie.top",
    "path": "/blogImg/{fullName}",
    "uploadPath": "/kwan/blogImg/{fullName}",
    "host": "43.139.90.182",
    "port": "22",
    "username": "root",
    "password": "xxxx"
  }
}
1
2
3
4
5
6
7
8
9
10
11
上次更新: 10/29/2024, 10:27:50 AM