-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathhexo-bo-ke-bu-shu-dao-teng-xun-yun-fu-wu-qi.html
2032 lines (1643 loc) · 72 KB
/
hexo-bo-ke-bu-shu-dao-teng-xun-yun-fu-wu-qi.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
<meta charset="utf-8">
<meta name="keywords" content="Hexo 博客部署到腾讯云服务器, Learning">
<meta name="baidu-site-verification" content="fmlEuI34ir">
<meta name="google-site-verification" content="yCy2azpds5XSuGZvis6OuA-XIGF5GuGpYRAaGfD6o48">
<meta name="360-site-verification" content="b7c11a830ef90fd1464ad6206bb7b6e7">
<meta name="description" content="
相信大家把博客部署到服务器都是为了加快访问速度,这里就不啰嗦了。
这篇教程没有使用宝塔Linux面板部署,浏览器访问会显示不安全,如果Hexo博客只部署到服务器,不部署到GitHub或者coding,那么请参照我的另一篇文章,使用宝塔">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit|ie-stand|ie-comp">
<meta name="mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Hexo 博客部署到腾讯云服务器 | Shawlon`s Blog</title>
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="stylesheet" type="text/css" href="/libs/awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
<link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
<link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
<link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
<link rel="stylesheet" type="text/css" href="/css/matery.css">
<link rel="stylesheet" type="text/css" href="/css/my.css">
<style type="text/css">
</style>
<script src="/libs/jquery/jquery-2.2.0.min.js"></script>
<script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?4d1d73af45a62734730491a6b6c41da4";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script>(function (i, s, o, g, r, a, m) {
i['DaoVoiceObject'] = r;
i[r] = i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
};
i[r].l = 1 * new Date();
a = s.createElement(o);
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
a.charset = 'utf-8';
m.parentNode.insertBefore(a, m);
})(window, document, 'script', ('https:' === document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/0fcc9bf7.js", 'daovoice');
daovoice('init', {
app_id: "0fcc9bf7",
});
daovoice('update');
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
(function(){
var src = "https://jspassport.ssl.qhimg.com/11.0.1.js?d182b3f28525f2db83acfaaf6e696dba";
document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
</script>
<meta name="baidu-site-verification" content="code-FwB5xSTmVO">
<style type="text/css" lang="css">
#loading-container{
position: fixed;
top: 0;
left: 0;
min-height: 100vh;
width: 100vw;
z-index: 9999;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #FFF;
text-align: center;
/* loaderҳ����ʧ���ý����ķ�ʽ*/
-webkit-transition: opacity 1s ease;
-moz-transition: opacity 1s ease;
-o-transition: opacity 1s ease;
transition: opacity 1s ease;
}
.loading-image{
width: 120px;
height: 50px;
transform: translate(-50%);
}
.loading-image div:nth-child(2) {
-webkit-animation: pacman-balls 1s linear 0s infinite;
animation: pacman-balls 1s linear 0s infinite
}
.loading-image div:nth-child(3) {
-webkit-animation: pacman-balls 1s linear .33s infinite;
animation: pacman-balls 1s linear .33s infinite
}
.loading-image div:nth-child(4) {
-webkit-animation: pacman-balls 1s linear .66s infinite;
animation: pacman-balls 1s linear .66s infinite
}
.loading-image div:nth-child(5) {
-webkit-animation: pacman-balls 1s linear .99s infinite;
animation: pacman-balls 1s linear .99s infinite
}
.loading-image div:first-of-type {
width: 0;
height: 0;
border: 25px solid #49b1f5;
border-right-color: transparent;
border-radius: 25px;
-webkit-animation: rotate_pacman_half_up .5s 0s infinite;
animation: rotate_pacman_half_up .5s 0s infinite;
}
.loading-image div:nth-child(2) {
width: 0;
height: 0;
border: 25px solid #49b1f5;
border-right-color: transparent;
border-radius: 25px;
-webkit-animation: rotate_pacman_half_down .5s 0s infinite;
animation: rotate_pacman_half_down .5s 0s infinite;
margin-top: -50px;
}
@-webkit-keyframes rotate_pacman_half_up {0% {transform: rotate(270deg)}50% {transform: rotate(1turn)}to {transform: rotate(270deg)}}
@keyframes rotate_pacman_half_up {0% {transform: rotate(270deg)}50% {transform: rotate(1turn)}to {transform: rotate(270deg)}}
@-webkit-keyframes rotate_pacman_half_down {0% {transform: rotate(90deg)}50% {transform: rotate(0deg)}to {transform: rotate(90deg)}}
@keyframes rotate_pacman_half_down {0% {transform: rotate(90deg)}50% {transform: rotate(0deg)}to {transform: rotate(90deg)}}
@-webkit-keyframes pacman-balls {75% {opacity: .7}to {transform: translate(-100px, -6.25px)}}
@keyframes pacman-balls {75% {opacity: .7}to {transform: translate(-100px, -6.25px)}}
.loading-image div:nth-child(3),
.loading-image div:nth-child(4),
.loading-image div:nth-child(5),
.loading-image div:nth-child(6){
background-color: #49b1f5;
width: 15px;
height: 15px;
border-radius: 100%;
margin: 2px;
width: 10px;
height: 10px;
position: absolute;
transform: translateY(-6.25px);
top: 25px;
left: 100px;
}
.loading-text{
margin-bottom: 20vh;
text-align: center;
color: #2c3e50;
font-size: 2rem;
box-sizing: border-box;
padding: 0 10px;
text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
@media only screen and (max-width: 500px) {
.loading-text{
font-size: 1.5rem;
}
}
.fadeout {
opacity: 0;
filter: alpha(opacity=0);
}
/* logo���ֶ��� */
@-webkit-keyframes fadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}100%{opacity:1;-webkit-transform:none;transform:none}}
@keyframes fadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-100%,0);}}
</style>
<script>
(function () {
const loaded = function(){
setTimeout(function(){
const loader = document.getElementById("loading-container");
loader.className="fadeout" ;//ʹ�ý����ķ�������loading page
// document.getElementById("body-wrap").style.display="flex";
setTimeout(function(){
loader.style.display="none";
},1000);
},1000);//ǿ����ʾloading page 1s
};
loaded();
})()
</script><link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css">
<link rel="stylesheet" href="/css/prism-line-numbers.css" type="text/css"><style type="text/css" lang="css">
#loading-container{
position: fixed;
top: 0;
left: 0;
min-height: 100vh;
width: 100vw;
z-index: 9999;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #FFF;
text-align: center;
/* loaderҳ����ʧ���ý����ķ�ʽ*/
-webkit-transition: opacity 1s ease;
-moz-transition: opacity 1s ease;
-o-transition: opacity 1s ease;
transition: opacity 1s ease;
}
.loading-image{
width: 120px;
height: 50px;
transform: translate(-50%);
}
.loading-image div:nth-child(2) {
-webkit-animation: pacman-balls 1s linear 0s infinite;
animation: pacman-balls 1s linear 0s infinite
}
.loading-image div:nth-child(3) {
-webkit-animation: pacman-balls 1s linear .33s infinite;
animation: pacman-balls 1s linear .33s infinite
}
.loading-image div:nth-child(4) {
-webkit-animation: pacman-balls 1s linear .66s infinite;
animation: pacman-balls 1s linear .66s infinite
}
.loading-image div:nth-child(5) {
-webkit-animation: pacman-balls 1s linear .99s infinite;
animation: pacman-balls 1s linear .99s infinite
}
.loading-image div:first-of-type {
width: 0;
height: 0;
border: 25px solid #49b1f5;
border-right-color: transparent;
border-radius: 25px;
-webkit-animation: rotate_pacman_half_up .5s 0s infinite;
animation: rotate_pacman_half_up .5s 0s infinite;
}
.loading-image div:nth-child(2) {
width: 0;
height: 0;
border: 25px solid #49b1f5;
border-right-color: transparent;
border-radius: 25px;
-webkit-animation: rotate_pacman_half_down .5s 0s infinite;
animation: rotate_pacman_half_down .5s 0s infinite;
margin-top: -50px;
}
@-webkit-keyframes rotate_pacman_half_up {0% {transform: rotate(270deg)}50% {transform: rotate(1turn)}to {transform: rotate(270deg)}}
@keyframes rotate_pacman_half_up {0% {transform: rotate(270deg)}50% {transform: rotate(1turn)}to {transform: rotate(270deg)}}
@-webkit-keyframes rotate_pacman_half_down {0% {transform: rotate(90deg)}50% {transform: rotate(0deg)}to {transform: rotate(90deg)}}
@keyframes rotate_pacman_half_down {0% {transform: rotate(90deg)}50% {transform: rotate(0deg)}to {transform: rotate(90deg)}}
@-webkit-keyframes pacman-balls {75% {opacity: .7}to {transform: translate(-100px, -6.25px)}}
@keyframes pacman-balls {75% {opacity: .7}to {transform: translate(-100px, -6.25px)}}
.loading-image div:nth-child(3),
.loading-image div:nth-child(4),
.loading-image div:nth-child(5),
.loading-image div:nth-child(6){
background-color: #49b1f5;
width: 15px;
height: 15px;
border-radius: 100%;
margin: 2px;
width: 10px;
height: 10px;
position: absolute;
transform: translateY(-6.25px);
top: 25px;
left: 100px;
}
.loading-text{
margin-bottom: 20vh;
text-align: center;
color: #2c3e50;
font-size: 2rem;
box-sizing: border-box;
padding: 0 10px;
text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
@media only screen and (max-width: 500px) {
.loading-text{
font-size: 1.5rem;
}
}
.fadeout {
opacity: 0;
filter: alpha(opacity=0);
}
/* logo���ֶ��� */
@-webkit-keyframes fadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}100%{opacity:1;-webkit-transform:none;transform:none}}
@keyframes fadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-100%,0);}}
</style>
<script>
(function () {
const loaded = function(){
setTimeout(function(){
const loader = document.getElementById("loading-container");
loader.className="fadeout" ;//ʹ�ý����ķ�������loading page
// document.getElementById("body-wrap").style.display="flex";
setTimeout(function(){
loader.style.display="none";
},1000);
},1000);//ǿ����ʾloading page 1s
};
loaded();
})()
</script></head>
<div id="loading-container">
<p class="loading-text"></p>
<div class="loading-image">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div><body>
<header class="navbar-fixed">
<nav id="headNav" class="bg-color nav-transparent">
<div id="navContainer" class="nav-wrapper container">
<div class="brand-logo">
<a href="/" class="waves-effect waves-light">
<img src="/medias/logo.png" class="logo-img" alt="LOGO">
<span class="logo-span">Shawlon`s Blog</span>
</a>
</div>
<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fa fa-navicon"></i></a>
<ul class="right">
<li class="hide-on-med-and-down">
<a href="/" class="waves-effect waves-light">
<span>首页</span>
</a>
</li>
<li class="hide-on-med-and-down">
<a href="/tags" class="waves-effect waves-light">
<span>标签</span>
</a>
</li>
<li class="hide-on-med-and-down">
<a href="/categories" class="waves-effect waves-light">
<span>分类</span>
</a>
</li>
<li class="hide-on-med-and-down">
<a href="/archives" class="waves-effect waves-light">
<span>归档</span>
</a>
</li>
<li class="hide-on-med-and-down">
<a href="/about" class="waves-effect waves-light">
<span>关于</span>
</a>
</li>
<li class="hide-on-med-and-down">
<a href="/friends" class="waves-effect waves-light">
<span>友情链接</span>
</a>
</li>
<li class="hide-on-med-and-down">
<a href="/contact" class="waves-effect waves-light">
<span>留言板</span>
</a>
</li>
<li>
<a href="#searchModal" class="modal-trigger waves-effect waves-light">
<i id="searchIcon" class="fa fa-search" title="搜索"></i>
</a>
</li>
</ul>
<div id="mobile-nav" class="side-nav sidenav">
<div class="mobile-head bg-color">
<img src="/medias/logo.png" class="logo-img circle responsive-img">
<div class="logo-name">Shawlon`s Blog</div>
<div class="logo-desc">
C/C++ | Linux | Ros
</div>
</div>
<ul class="menu-list mobile-menu-list">
<li>
<a href="/" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
首页
</a>
</li>
<li>
<a href="/tags" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
标签
</a>
</li>
<li>
<a href="/categories" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
分类
</a>
</li>
<li>
<a href="/archives" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
归档
</a>
</li>
<li>
<a href="/about" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
关于
</a>
</li>
<li>
<a href="/friends" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
友情链接
</a>
</li>
<li>
<a href="/contact" class="waves-effect waves-light">
<i class="fa fa-fw fa-link"></i>
留言板
</a>
</li>
<li><div class="divider"></div></li>
<li>
<a href="https://github.com/muyiio" class="waves-effect waves-light" target="_blank">
<i class="fa fa-github-square fa-fw"></i>Fork Me
</a>
</li>
</ul>
</div>
</div>
<style>
.nav-transparent .github-corner {
display: none !important;
}
.github-corner {
position: absolute;
z-index: 10;
top: 0;
right: 0;
border: 0;
transform: scale(1.1);
}
.github-corner svg {
color: #0f9d58;
fill: #fff;
height: 64px;
width: 64px;
}
.github-corner:hover .octo-arm {
animation: a 0.56s ease-in-out;
}
.github-corner .octo-arm {
animation: none;
}
@keyframes a {
0%,
to {
transform: rotate(0);
}
20%,
60% {
transform: rotate(-25deg);
}
40%,
80% {
transform: rotate(10deg);
}
}
</style>
<a href="https://github.com/muyiio" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
data-tooltip="Fork Me" data-position="left" data-delay="50">
<svg viewBox="0 0 250 250" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg>
</a>
</nav>
</header>
<script src="/libs/cryptojs/crypto-js.min.js"></script>
<script>
(function() {
let pwd = '';
if (pwd && pwd.length > 0) {
if (pwd !== CryptoJS.SHA256(prompt('请输入访问本文章的密码')).toString(CryptoJS.enc.Hex)) {
alert('密码错误,将返回主页!');
location.href = '/';
}
}
})();
</script>
<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/16.jpg')">
<div class="container">
<div class="row">
<div class="col s12 m12 l12">
<div class="brand">
<div class="description center-align post-title">
Hexo 博客部署到腾讯云服务器
</div>
</div>
</div>
</div>
</div>
</div>
<main class="post-container content">
<link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
#articleContent h1::before,
#articleContent h2::before,
#articleContent h3::before,
#articleContent h4::before,
#articleContent h5::before,
#articleContent h6::before {
display: block;
content: " ";
height: 100px;
margin-top: -100px;
visibility: hidden;
}
#articleContent :focus {
outline: none;
}
.toc-fixed {
position: fixed;
top: 64px;
}
.toc-widget {
padding-left: 20px;
}
.toc-widget .toc-title {
margin: 35px 0 15px 0;
padding-left: 17px;
font-size: 1.5rem;
font-weight: bold;
line-height: 1.5rem;
}
.toc-widget ol {
padding: 0;
list-style: none;
}
#toc-content ol {
padding-left: 10px;
}
#toc-content ol li {
padding-left: 10px;
}
#toc-content .toc-link:hover {
color: #42b983;
font-weight: 700;
text-decoration: underline;
}
#toc-content .toc-link::before {
background-color: transparent;
max-height: 25px;
}
#toc-content .is-active-link {
color: #42b983;
}
#toc-content .is-active-link::before {
background-color: #42b983;
}
#floating-toc-btn {
position: fixed;
right: 20px;
bottom: 76px;
padding-top: 15px;
margin-bottom: 0;
z-index: 998;
}
#floating-toc-btn .btn-floating {
width: 48px;
height: 48px;
}
#floating-toc-btn .btn-floating i {
line-height: 48px;
font-size: 1.4rem;
}
</style>
<div class="row">
<div id="main-content" class="col s12 m12 l9">
<!-- 文章内容详情 -->
<div id="artDetail">
<div class="card">
<div class="card-content article-info">
<div class="row tag-cate">
<div class="col s7">
<div class="article-tag">
<a href="/tags/Hexo/" target="_blank">
<span class="chip bg-color">Hexo</span>
</a>
</div>
</div>
<div class="col s5 right-align">
<div class="post-cate">
<i class="fa fa-bookmark fa-fw icon-category"></i>
<a href="/categories/服务器/" class="post-category" target="_blank">
服务器
</a>
</div>
</div>
</div>
<div class="post-info">
<div class="post-date info-break-policy">
<i class="fa fa-calendar-minus-o fa-fw"></i>发布日期:
2023-03-28
</div>
<div class="post-author info-break-policy">
<i class="fa fa-user-o fa-fw"></i>作者:
Tyzhao
</div>
<div class="info-break-policy">
<i class="fa fa-file-word-o fa-fw"></i>文章字数:
1.7k
</div>
<div class="info-break-policy">
<i class="fa fa-clock-o fa-fw"></i>阅读时长:
7 分
</div>
<div id="busuanzi_container_page_pv" class="info-break-policy">
<i class="fa fa-eye fa-fw"></i>阅读次数:
<span id="busuanzi_value_page_pv"></span>
</div>
</div>
</div>
<hr class="clearfix">
<div class="card-content article-card-content">
<div id="articleContent">
<blockquote>
<p> 相信大家把博客部署到服务器都是为了加快访问速度,这里就不啰嗦了。</p>
</blockquote>
<p><strong>这篇教程没有使用宝塔Linux面板部署,浏览器访问会显示不安全,如果Hexo博客只部署到服务器,不部署到GitHub或者coding,那么请参照我的另一篇文章,使用宝塔面板更为方便,主要是为了部署SSL。</strong></p>
<p><strong><a href="https://www.muyiio.com/2020/04/10/shi-yong-bao-ta-mian-ban-yi-jian-bu-shu-hexo-bo-ke/" target="_blank" rel="noopener">Hexo博客部署到腾讯云服务器(使用宝塔面板)</a></strong></p>
<p>我的服务器</p>
<ul>
<li><p>系统 <code>CentOS 7.5 64bit</code></p>
</li>
<li><p>配置 <code>标准型S2/1核/2GB/1Mbps</code></p>
</li>
</ul>
<p>服务器需要的环境</p>
<ul>
<li>环境:<code>git</code>,<code>Nginx</code></li>
<li>使用<code>git</code> 自动化部署发布</li>
</ul>
<p>打开腾讯云,进入【云服务器】→【登录】</p>
<p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/02.png" alt></p>
<blockquote>
<p> 初始密码在右上角消息里面有</p>
</blockquote>
<h1 id="1】Git安装及配置"><a href="#1】Git安装及配置" class="headerlink" title="1】Git安装及配置"></a>1】Git安装及配置</h1><h3 id="一、安装依赖库和编译工具"><a href="#一、安装依赖库和编译工具" class="headerlink" title="一、安装依赖库和编译工具"></a>一、安装依赖库和编译工具</h3><ul>
<li><p>安装依赖库:</p>
<pre class="line-numbers language-c++c"><code class="language-c++c">yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
</li>
</ul>
<p>然后会出现:</p>
<pre><code>Is this ok [y/d/N]:</code></pre><p>输入<code>y</code>继续安装,后面也一样。</p>
<ul>
<li><p>安装编译工具:</p>
<pre><code>yum install gcc perl-ExtUtils-MakeMaker package </code></pre></li>
</ul>
<h3 id="二、下载-git并解压编译安装"><a href="#二、下载-git并解压编译安装" class="headerlink" title="二、下载 git并解压编译安装"></a>二、下载 git并解压编译安装</h3><ul>
<li>查看服务器已有的git版本</li>
</ul>
<pre><code>git --version</code></pre><p>然后会看到:</p>
<pre><code>git version 1.8.3.1</code></pre><blockquote>
<p>但是官网版本已经更新了,因为yum仓库的Git版本更新的时间会存在延时,我们这里采用源码包安装方式安装。</p>
</blockquote>
<ul>
<li>将陈旧版本的git删除</li>
</ul>
<pre><code>yum remove git</code></pre><ul>
<li><p>选择一个目录来存放下载下来的 git 安装包。这里选择了<code>/usr/local/src</code> 目录</p>
<pre><code>cd /usr/local/src </code></pre></li>
</ul>
<ul>
<li>下载最新版git到<code>/usr/local/src</code>,可以在官网找到版本,目前最新版本是2.26.0。</li>
</ul>
<pre><code>wget http://ftp.ntu.edu.tw/software/scm/git/git-2.26.0.tar.gz</code></pre><ul>
<li>解压到当前目录</li>
</ul>
<pre><code>tar -zvxf git-2.26.0.tar.gz</code></pre><ul>
<li>进入 <code>git-2.26.0.tar.gz</code> 目录下</li>
</ul>
<pre><code>cd git-2.26.0</code></pre><ul>
<li>执行编译</li>
</ul>
<pre><code>make prefix=/usr/local/git all</code></pre><ul>
<li>安装 git 到 /usr/local/git 目录下</li>
</ul>
<pre><code>make prefix=/usr/local/git install</code></pre><h3 id="三、配置-git-环境变量"><a href="#三、配置-git-环境变量" class="headerlink" title="三、配置 git 环境变量"></a>三、配置 git 环境变量</h3><ul>
<li>打开环境变量配置文件</li>
</ul>
<pre><code>vim /etc/profile</code></pre><p>按i进入编辑模式,按向下键到底部,添加下面两行命令:</p>
<pre><code>PATH=$PATH:/usr/local/git/bin # git 的目录
export PATH</code></pre><p><strong>按<code>esc</code>退出,按<code>:wq</code>保存编辑。(注意是先<code>:</code>再是<code>wq</code>)</strong></p>
<p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/QQ%E5%9B%BE%E7%89%8720200402004810.png" alt></p>
<ul>
<li>使 git 环境变量生效</li>
</ul>
<pre><code> source /etc/profile</code></pre><ul>
<li>验证安装完成,查看 git 的版本号</li>
</ul>
<pre><code>git --version</code></pre><p>这时候我们的git版本已经变成了:</p>
<pre><code>git version 2.26.0</code></pre><p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/QQ%E5%9B%BE%E7%89%8720200402004827.png" alt></p>
<h3 id="四、创建-git-用户"><a href="#四、创建-git-用户" class="headerlink" title="四、创建 git 用户"></a>四、创建 git 用户</h3><ul>
<li>创建git用户</li>
</ul>
<pre><code>adduser git</code></pre><ul>
<li>获取权限</li>
</ul>
<pre><code>chmod 740 /etc/sudoers
vim /etc/sudoers</code></pre><p>按 <code>i</code> 键进入文件的编辑模式,按向下键找到如下字段</p>
<pre><code>root ALL=(ALL) ALL</code></pre><p>在其后面增加一句:</p>
<pre><code>git ALL=(ALL) ALL</code></pre><p><strong>按 <code>Esc</code> 键退出编辑模式,输入<code>:wq</code> 保存退出。(先输入<code>:</code>,然后输入<code>wq</code>回车)</strong></p>
<ul>
<li>退回权限</li>
</ul>
<pre><code>chmod 400 /etc/sudoers</code></pre><h3 id="五、配置密钥"><a href="#五、配置密钥" class="headerlink" title="五、配置密钥"></a>五、配置密钥</h3><ul>
<li>创建密钥</li>
</ul>
<p>来到这里的小伙伴应该都已经有了自己的hexo博客,那么肯定已经创建过自己的密钥,一般存放在<code>c/用户/.ssh</code>下。</p>
<p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/QQ%E5%9B%BE%E7%89%8720200402004830.png" alt></p>
<p>如果没有自己的密钥,可以移步我之前的教程,里面有密钥创建步骤</p>
<p><a href="https://www.muyiio.com/2020/02/18/1/" target="_blank" rel="noopener">Github + Hexo 搭建个人博客超详细教程</a></p>
<ul>
<li>将密钥保存在服务器(之前有密钥的直接复制就可以)</li>
</ul>
<p>将<code>id_rsa.pub</code>里面的密钥复制,在服务器运行下面命令,创建.ssh文件夹</p>
<pre><code>su git
mkdir ~/.ssh</code></pre><p>创建<code>.ssh/authorized_keys</code>文件,打开<code>authorized_keys</code>文件并将刚才在本地机器复制的内容拷贝其中并保存</p>
<pre><code>vim ~/.ssh/authorized_keys</code></pre><p><strong>按<code>i</code>进入编辑模式粘贴完按 <code>Esc</code> 键退出编辑模式,输入<code>:wq</code> 保存退出。(先输入<code>:</code>,然后输入<code>wq</code>回车)</strong></p>
<ul>
<li>修改权限</li>
</ul>
<pre><code>chmod 755 ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys</code></pre><ul>
<li><p>测试本地连接服务器</p>
<p>在本地电脑git bash here</p>
</li>
</ul>
<pre><code>//yourIp为远程服务器的ip地址
ssh -v git@yourIp //yourIp为你的服务器ip</code></pre><p>如图则证明本地机器与远程机器已经接通</p>
<p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/QQ%E5%9B%BE%E7%89%8720200402004834.png" alt></p>
<h3 id="六、创建git仓库"><a href="#六、创建git仓库" class="headerlink" title="六、创建git仓库"></a>六、创建git仓库</h3><ul>
<li>切换到root用户,创建一个目录用于存储网站的根目录</li>
</ul>
<pre><code>su root</code></pre><ul>
<li>创建网站的根目录</li>
</ul>
<pre><code>mkdir /home/hexo</code></pre><ul>
<li>给予权限</li>
</ul>
<pre><code>chown gitgit -R //hexo</code></pre><h1 id="2】安装Nginx"><a href="#2】安装Nginx" class="headerlink" title="2】安装Nginx"></a>2】安装Nginx</h1><blockquote>
<p><em>Nginx</em> (engine x) 是一个高性能的<a href="https://baike.baidu.com/item/HTTP" target="_blank" rel="noopener">HTTP</a>和<a href="https://baike.baidu.com/item/反向代理/7793488" target="_blank" rel="noopener">反向代理</a>web服务器,同时也提供了IMAP/POP3/SMTP<a href="https://baike.baidu.com/item/服务/100571" target="_blank" rel="noopener">服务</a></p>
</blockquote>
<h3 id="一、安装配置Nginx"><a href="#一、安装配置Nginx" class="headerlink" title="一、安装配置Nginx"></a>一、安装配置Nginx</h3><ul>
<li>安装Nginx</li>
</ul>
<pre><code>yum install -y nginx</code></pre><ul>
<li>配置Nginx</li>
</ul>
<pre><code>nginx -t</code></pre><p>使用vim打开nginx.conf文件</p>
<pre><code>vim /etc/nginx/nginx.conf</code></pre><p><strong>按<code>i</code>进入编辑模式粘贴完按 <code>Esc</code> 键退出编辑模式,输入<code>:wq</code> 保存退出。(先输入<code>:</code>,然后输入<code>wq</code>回车)</strong></p>
<pre class="line-numbers language-j"><code class="language-j">server <span class="token verb keyword">{</span>
listen <span class="token number">80</span> default_server<span class="token verb keyword">;</span>
listen <span class="token verb keyword">[:</span><span class="token conjunction variable">:</span><span class="token verb keyword">]</span><span class="token conjunction variable">:</span><span class="token number">80</span> default_server<span class="token verb keyword">;</span>
server_name www<span class="token conjunction variable">.</span>muyii<span class="token verb keyword">o.</span>com<span class="token verb keyword">;</span> <span class="token adverb builtin">/</span><span class="token adverb builtin">/</span>你的博客域名
root <span class="token adverb builtin">/</span>home<span class="token adverb builtin">/</span>hexo<span class="token verb keyword">;</span> <span class="token adverb builtin">/</span><span class="token adverb builtin">/</span>git仓库目录
<span class="token verb keyword">#</span> Load configuration files for the default server block<span class="token conjunction variable">.</span>
include <span class="token adverb builtin">/</span>etc<span class="token adverb builtin">/</span>nginx<span class="token adverb builtin">/</span>defaul<span class="token adverb builtin">t.</span>d<span class="token adverb builtin">/</span><span class="token verb keyword">*.</span>conf<span class="token verb keyword">;</span>
location <span class="token adverb builtin">/</span> <span class="token verb keyword">{</span>
<span class="token adverb builtin">}</span>
j
error_page <span class="token number">404</span> <span class="token adverb builtin">/</span><span class="token number">404</span><span class="token conjunction variable">.</span>html<span class="token verb keyword">;</span>
location <span class="token verb keyword">=</span> <span class="token adverb builtin">/</span><span class="token number">40</span>x<span class="token conjunction variable">.</span>html <span class="token verb keyword">{</span>
<span class="token adverb builtin">}</span>
error_page <span class="token number">500</span> <span class="token number">502</span> <span class="token number">503</span> <span class="token number">504</span> <span class="token adverb builtin">/</span><span class="token number">50</span>x<span class="token conjunction variable">.</span>html<span class="token verb keyword">;</span>
location <span class="token verb keyword">=</span> <span class="token adverb builtin">/</span><span class="token number">50</span>x<span class="token conjunction variable">.</span>html <span class="token verb keyword">{</span>
<span class="token adverb builtin">}</span>
<span class="token adverb builtin">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/QQ%E5%9B%BE%E7%89%8720200402004838.png" alt></p>
<ul>
<li>启动Nginx</li>
</ul>
<pre><code>systemctl start nginx.service</code></pre><ul>
<li>重启Nginx</li>
</ul>
<pre><code>systemctl restart nginx.service</code></pre><h3 id="二、自动化部署"><a href="#二、自动化部署" class="headerlink" title="二、自动化部署"></a>二、自动化部署</h3><ul>
<li>获取root权限</li>
</ul>
<pre><code>su root</code></pre><ul>
<li>建立git仓库</li>
</ul>
<pre><code>cd /home/git
git init --bare blog.git</code></pre><ul>
<li>修改blog.git权限</li>
</ul>
<pre><code>chown git:git -R blog.git</code></pre><ul>
<li>在 <code>/home/hexo/blog.git</code> 下,有一个自动生成的 <code>hooks</code> 文件夹,我们创建一个新的 <code>git</code> 钩子 <code>post-receive</code>,用于自动部署。</li>
</ul>
<pre><code>vim blog.git/hooks/post-receive</code></pre><ul>
<li><strong>按 <code>i</code> 键进入文件的编辑模式</strong>,在该文件中添加两行代码(将下边的代码粘贴进去),指定 Git 的工作树(源代码)和 Git 目录</li>
</ul>
<pre><code> #!/bin/bash
git --work-tree=/home/hexo --git-dir=/home/git/blog.git checkout -f </code></pre><p><strong>按 <code>Esc</code> 键退出编辑模式,输入<code>:wq</code> 保存退出。(先输入<code>:</code>,然后输入<code>wq</code>回车)</strong></p>
<p><img src="https://cdn.jsdelivr.net/gh/MUYIio/[email protected]/Images/posts/%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1%E5%99%A8/QQ%E5%9B%BE%E7%89%8720200402004843.png" alt></p>
<ul>
<li>修改文件权限,使得其可执行。</li>
</ul>
<pre><code>chmod +x /home/git/blog.git/hooks/post-receive</code></pre><h1 id="3】配置本地Hexo"><a href="#3】配置本地Hexo" class="headerlink" title="3】配置本地Hexo"></a>3】配置本地Hexo</h1><ul>
<li>博客根目录_config下增加</li>
</ul>
<pre><code>deploy:
type: git
repo: root@***(服务器ip,内网外网都行):/home/git/blog.git #仓库地址
branch: master #分支</code></pre><ul>
<li>部署</li>
</ul>
<pre><code>hexo clean
hexo g
hexo d</code></pre><ul>
<li>输入<code>hexo d</code>的时候,会要求你输入自己的服务器密码</li>
</ul>
<pre><code>Branch 'master' set up to track remote branch 'master' from 'https://e.coding.net/godxiaolon/godxiaolon.git'.
On branch master
nothing to commit, working tree clean