<!DOCTYPE html>
< html lang = "" >
< head >
< title > Centos7脚本一键安装Typecho - EEE.DOG< / title > < meta charset = "UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1, maximum-scale=1" / >
< meta http-equiv = "Cache-Control" content = "no-transform" / >
< meta http-equiv = "Cache-Control" content = "no-siteapp" / >
< meta name = "theme-color" content = "#f8f5ec" / >
< meta name = "msapplication-navbutton-color" content = "#f8f5ec" >
< meta name = "apple-mobile-web-app-capable" content = "yes" >
< meta name = "apple-mobile-web-app-status-bar-style" content = "#f8f5ec" >
< meta name = "description" content = "Centos7脚本一键安装Typecho" / > < meta name = "keywords" content = "iotcat,yimian,blog" / > < link rel = "alternate" href = "/atom.xml" title = "EEE.DOG" > < link rel = "shortcut icon" type = "image/x-icon" href = "/favicon.ico?v=1.0.0" / > < script > lang = [ 'zh' , 'en' ] ; < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/ushio-js/ushio-head.min.js" > < / script >
< link rel = "stylesheet" type = "text/css" href = "https://cdn.yimian.xyz/kayo/lib/iziModal/iziModal.min.css" / >
< link rel = "stylesheet" type = "text/css" href = "https://cdn.yimian.xyz/kayo/lib/iziToast/iziToast.min.css" / >
< link rel = "stylesheet" type = "text/css" href = "https://cdn.yimian.xyz/shaky/shaky.css" >
< link rel = "canonical" href = "https://www.eee.dog/tech/centos7-auto-install-typecho.html" / >
< link rel = "stylesheet" type = "text/css" href = "https://cdn.yimian.xyz/kayo/lib/fancybox/jquery.fancybox.css" / > < script type = "text/x-mathjax-config" >
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });
< / script >
< script type = "text/javascript" async src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" > < / script >
< link rel = "stylesheet" type = "text/css" href = "https://cdn.yimian.xyz/kayo/css/style.css?v=1.0.0" / >
<!-- Global site tag (gtag.js) - Google Analytics -->
< script async src = "https://www.googletagmanager.com/gtag/js?id=UA-169276192-1" data-pjax > < / script >
< script >
pjax_google_analytics = () => {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-169276192-1');
}
< / script > < script id = "baidu_push" >
(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 >
window.config = {"leancloud":"","toc":true,"fancybox":true,"pjax":{"enable":true,"loadingbar":true},"latex":true};
< / script >
< meta name = "generator" content = "Hexo 4.2.1" > < link rel = "alternate" href = "/atom.xml" title = "EEE.DOG" type = "application/atom+xml" >
< / head >
< body > < div id = "mobile-navbar" class = "mobile-navbar" >
< div class = "mobile-header-logo" >
< a href = "/." class = "logo" > EEE.DOG< / a >
< / div >
< div class = "mobile-navbar-icon" >
< span > < / span >
< span > < / span >
< span > < / span >
< / div >
< div class = "loading-bar" >
< div class = "progress" > < / div >
< / div >
< / div >
< nav id = "mobile-menu" class = "mobile-menu slideout-menu" >
< ul class = "mobile-menu-list" > < div id = "mobile-menu-Archives" >
< a href = "/archives/" >
< li class = "mobile-menu-item" > < span class = ".en" > Archives< / span > < span class = ".zh" > 归档< / span >
< / li >
< / a > < / div > < div id = "mobile-menu-Categories" >
< a href = "/categories/" >
< li class = "mobile-menu-item" > < span class = ".en" > Categories< / span > < span class = ".zh" > 分类< / span >
< / li >
< / a > < / div > < div id = "mobile-menu-Projects" >
< a href = "#" >
< li class = "mobile-menu-item" > < span class = ".en" > Projects< / span > < span class = ".zh" > 项目< / span >
< / li >
< / a > < ul class = "sub-menu" style = "display: none;" >
< li >
< a href = "https://fp.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > fp< / span > < span class = ".zh" > fp< / span >
< / a >
< / li >
< li >
< a href = "https://wiot.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > wiot< / span > < span class = ".zh" > wiot< / span >
< / a >
< / li >
< / ul >
< script > $ ( ' # m o b i l e - m e n u - P r o j e c t s ' ) . c l i c k ( f u n c t i o n ( ) {
$("#mobile-menu-Projects ul").toggle();
})< / script >
< / div > < div id = "mobile-menu-Map" >
< a href = "#" >
< li class = "mobile-menu-item" > < span class = ".en" > Map< / span > < span class = ".zh" > 导航< / span >
< / li >
< / a > < ul class = "sub-menu" style = "display: none;" >
< li >
< a href = "https://api.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > APIs< / span > < span class = ".zh" > 接口< / span >
< / a >
< / li >
< li >
< a href = "https://img.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > Imgs< / span > < span class = ".zh" > 图库< / span >
< / a >
< / li >
< li >
< a href = "/" >
< span class = ".en" > Imgbed< / span > < span class = ".zh" > 图床< / span >
< / a >
< / li >
< li >
< a href = "https://share.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > Fileshare< / span > < span class = ".zh" > 文件分享< / span >
< / a >
< / li >
< li >
< a href = "https://monitor.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > Monitor< / span > < span class = ".zh" > 监控< / span >
< / a >
< / li >
< li >
< a href = "https://acg.watch/" target = "_blank" rel = "noopener" >
< span class = ".en" > ACG.WATCH< / span > < span class = ".zh" > 视频< / span >
< / a >
< / li >
< li >
< a href = "https://onedrive.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > Oneindex< / span > < span class = ".zh" > 网盘< / span >
< / a >
< / li >
< li >
< a href = "https://proxy.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > Proxy< / span > < span class = ".zh" > 下载代理< / span >
< / a >
< / li >
< li >
< a href = "https://shorturl.yimian.xyz/" target = "_blank" rel = "noopener" >
< span class = ".en" > ShortenURL< / span > < span class = ".zh" > 短链< / span >
< / a >
< / li >
< / ul >
< script > $ ( ' # m o b i l e - m e n u - M a p ' ) . c l i c k ( f u n c t i o n ( ) {
$("#mobile-menu-Map ul").toggle();
})< / script >
< / div > < div id = "mobile-menu-About" >
< a href = "#" >
< li class = "mobile-menu-item" > < span class = ".en" > About< / span > < span class = ".zh" > 关于< / span >
< / li >
< / a > < ul class = "sub-menu" style = "display: none;" >
< li >
< a href = "/links/" >
< span class = ".en" > links< / span > < span class = ".zh" > < / span >
< / a >
< / li >
< li >
< a href = "https://iotcat.me/" target = "_blank" rel = "noopener" >
< span class = ".en" > Me< / span > < span class = ".zh" > < / span >
< / a >
< / li >
< / ul >
< script > $ ( ' # m o b i l e - m e n u - A b o u t ' ) . c l i c k ( f u n c t i o n ( ) {
$("#mobile-menu-About ul").toggle();
})< / script >
< / div > < / ul >
< / nav >
< div class = "container" id = "mobile-panel" >
< header id = "header" class = "header" > < div class = "logo-wrapper" >
< a href = "/." class = "logo" > EEE.DOG< / a >
< / div >
< nav class = "site-navbar" > < ul id = "menu" class = "menu" > < li class = "menu-item" >
< a id = "menu-Archives" class = "menu-item-link" href = "/archives/" >
< span class = ".en" > Archives< / span > < span class = ".zh" > 归档< / span >
< / a >
< / li >
< li class = "menu-item" >
< a id = "menu-Categories" class = "menu-item-link" href = "/categories/" >
< span class = ".en" > Categories< / span > < span class = ".zh" > 分类< / span >
< / a >
< / li >
< li class = "menu-item" >
< a id = "menu-Projects" class = "menu-item-link" href = "#" >
< span class = ".en" > Projects< / span > < span class = ".zh" > 项目< / span >
< / a >
< script >
$("#menu-Projects").click(function(){
tips.question({
timeout: 20000,
close: false,
overlay: true,
displayMode: 'once',
//id: 'question',
zindex: 999,
title: 'Projects',
message: '',
position: 'center',
buttons: [
['< button > < b > '+((page.tran.getLang() != 'zh')?'fp':'fp')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://fp.yimian.xyz/");
else
window.location.href="https://fp.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'wiot':'wiot')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://wiot.yimian.xyz/");
else
window.location.href="https://wiot.yimian.xyz/";
}, true],
['< button > < b > close< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
}, true],
]
});
});
< / script >
< / li >
< li class = "menu-item" >
< a id = "menu-Map" class = "menu-item-link" href = "#" >
< span class = ".en" > Map< / span > < span class = ".zh" > 导航< / span >
< / a >
< script >
$("#menu-Map").click(function(){
tips.question({
timeout: 20000,
close: false,
overlay: true,
displayMode: 'once',
//id: 'question',
zindex: 999,
title: 'Map',
message: '',
position: 'center',
buttons: [
['< button > < b > '+((page.tran.getLang() != 'zh')?'APIs':'接口')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://api.yimian.xyz/");
else
window.location.href="https://api.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Imgs':'图库')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://img.yimian.xyz/");
else
window.location.href="https://img.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Imgbed':'图床')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("/");
else
window.location.href="undefined";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Fileshare':'文件分享')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://share.yimian.xyz/");
else
window.location.href="https://share.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Monitor':'监控')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://monitor.yimian.xyz/");
else
window.location.href="https://monitor.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'ACG.WATCH':'视频')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://acg.watch/");
else
window.location.href="https://acg.watch/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Oneindex':'网盘')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://onedrive.yimian.xyz/");
else
window.location.href="https://onedrive.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Proxy':'下载代理')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://proxy.yimian.xyz/");
else
window.location.href="https://proxy.yimian.xyz/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'ShortenURL':'短链')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://shorturl.yimian.xyz/");
else
window.location.href="https://shorturl.yimian.xyz/";
}, true],
['< button > < b > close< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
}, true],
]
});
});
< / script >
< / li >
< li class = "menu-item" >
< a id = "menu-About" class = "menu-item-link" href = "#" >
< span class = ".en" > About< / span > < span class = ".zh" > 关于< / span >
< / a >
< script >
$("#menu-About").click(function(){
tips.question({
timeout: 20000,
close: false,
overlay: true,
displayMode: 'once',
//id: 'question',
zindex: 999,
title: 'About',
message: '',
position: 'center',
buttons: [
['< button > < b > '+((page.tran.getLang() != 'zh')?'links':'')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("true" == "true")
pjax.loadUrl("/links/");
else
window.location.href="/links/";
}, true],
['< button > < b > '+((page.tran.getLang() != 'zh')?'Me':'')+'< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
if("undefined" == "true")
pjax.loadUrl("https://iotcat.me/");
else
window.location.href="https://iotcat.me/";
}, true],
['< button > < b > close< / b > < / button > ', function (instance, toast) {
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
}, true],
]
});
});
< / script >
< / li >
< / ul > < / nav >
< / header >
< main id = "main" class = "main" >
< div class = "content-wrapper" >
< div id = "content" class = "content" > < article class = "post" >
< header class = "post-header" >
< h1 class = "post-title" > < span class = ".zh" > Centos7脚本一键安装Typecho< / span > < span class = ".en" hidden > Centos7 script one-click installation of Typecho< / span >
< / h1 >
< div class = "post-meta" >
< span class = "post-time" >
2019-02-25
< / span > < span class = "post-category" >
< a href = "/categories/tech/" > tech< / a >
< / span >
< / div >
< / header >
< style > . toc-level-2 > . toc-child { display : none !important ; } < / style >
< div class = "post-toc" id = "post-toc" >
< h2 class = "post-toc-title" > Contents< / h2 >
< div class = "post-toc-content" >
< ol class = "toc" > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#先觉条件" > < span class = "toc-text" > 先觉条件< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#一键安装" > < span class = "toc-text" > 一键安装< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#轻松开始" > < span class = "toc-text" > 轻松开始< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#自定义域名配置" > < span class = "toc-text" > 自定义域名配置< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#https配置" > < span class = "toc-text" > https配置< / span > < / a > < ol class = "toc-child" > < li class = "toc-item toc-level-3" > < a class = "toc-link" href = "#法一" > < span class = "toc-text" > 法一< / span > < / a > < / li > < li class = "toc-item toc-level-3" > < a class = "toc-link" href = "#法二" > < span class = "toc-text" > 法二< / span > < / a > < / li > < / ol > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#A-priori-condition" > < span class = "toc-text" > A priori condition< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#A-key-installation" > < span class = "toc-text" > A key installation< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#Easy-start" > < span class = "toc-text" > Easy start< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#Custom-domain-configuration" > < span class = "toc-text" > Custom domain configuration< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#https-configuration" > < span class = "toc-text" > https configuration< / span > < / a > < ol class = "toc-child" > < li class = "toc-item toc-level-3" > < a class = "toc-link" href = "#Method-One" > < span class = "toc-text" > Method One< / span > < / a > < / li > < li class = "toc-item toc-level-3" > < a class = "toc-link" href = "#Method-two" > < span class = "toc-text" > Method two< / span > < / a > < / li > < / ol > < / li > < / ol >
< / div >
< / div >
< script > var arr = [ ] ; var ts = '' ; if ( $ ( '.post-toc-content' ) . children ( ) . length > 1 ) { var el = '.post-toc-content' ; ts = ( $ ( el ) . children ( 'ol' ) [ 0 ] . outerHTML ) ; } else { var el = '.toc' ; } ; for ( var i = 0 ; i < $ ( el ) . children ( 'li' ) . length ; i ++ ) { arr . push ( $ ( el ) . children ( 'li' ) [ i ] . outerHTML ) ; } ; arr . splice ( arr . length / 2 , 0 , '</span><span class=".en">' ) ; arr . unshift ( ts ) ; arr . unshift ( '<span class=".zh">' ) ; arr . push ( '</span>' ) ; $ ( el ) . html ( arr . join ( '' ) ) ; < / script > < div class = "post-content" > < span class = ".zh" >
< p > 一时兴起,帮番茄同学(< a href = "https://tomatotrees.xyz" target = "_blank" rel = "noopener" > @番茄树< / a > )配置了博客,在此记录一下流程 < / p >
< / span >
< span class = ".en" >
< p > On a whim, help Pomodoro (< a href = "https://tomatotrees.xyz" target = "_blank" rel = "noopener" > @tomatotree< / a > ) configure a blog, and record the process here< / p >
< / span >
< a id = "more" > < / a >
< script >
session.onload(function(){
if(page.tran.getLang() == 'en'){
tips.warning({
title: 'Caution',
position: 'topRight',
message: 'This page was translated by Machine!!',
buttons: [['< button > Show Original Page< / button > ', function (instance, toast) {
page.tran.setLang('zh');
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
}, true]]
});
}
});
< / script >
< span class = ".zh" >
< h2 id = "先觉条件" > < a href = "#先觉条件" class = "headerlink" title = "先觉条件" > < / a > 先觉条件< / h2 > < ul >
< li > 只测试过阿里云腾讯云Centos7学生机< / li >
< li > 系统很干净,最好刚重装过< / li >
< li > 使用root权限< / li >
< / ul >
< h2 id = "一键安装" > < a href = "#一键安装" class = "headerlink" title = "一键安装" > < / a > 一键安装< / h2 > < p > 无聊写了一个一键搭建脚本,使用如下指令运行(详见< a href = "https://github.com/IoTcat/typecho-auto-install-centos7" target = "_blank" rel = "noopener" > github< / a > )< / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > $ wget https:/ / yimian-setup.obs.myhwclouds.com/ sh/ auto.sh & & sh auto.sh< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > 如果不出意外安装将自动进行,安装最后需要你手动输入如下数据库配置指令。< / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < span class = "line" > 2< / span > < br > < span class = "line" > 3< / span > < br > < span class = "line" > 4< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > use mysql< / span > < br > < span class = "line" > UPDATE user SET Password = ' 你的密码' WHERE User = ' root' ;< / span > < br > < span class = "line" > create database typecho;< / span > < br > < span class = "line" > quit< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< h2 id = "轻松开始" > < a href = "#轻松开始" class = "headerlink" title = "轻松开始" > < / a > 轻松开始< / h2 > < p > 安装完成后,使用你的浏览器访问以下链接< / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > http:/ / 你的服务器ip< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > 根据页面提示安装typecho< br > 大部分内容保持默认即可,只需填写:< / p >
< ul >
< li > 数据库密码(你刚才设置的)< / li >
< li > 管理员用户名< / li >
< li > 管理员登录密码< / li >
< li > 管理员邮箱地址< / li >
< / ul >
< h2 id = "自定义域名配置" > < a href = "#自定义域名配置" class = "headerlink" title = "自定义域名配置" > < / a > 自定义域名配置< / h2 > < p > 首先在你的域名服务商(腾讯云,阿里云)将你的域名A解析到你的服务器ip< br > < strong > 打开服务器上nginx配置文件< / strong > < / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > $ vi / etc/ nginx/ nginx.conf< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > 将文件中第42,47,48行的 your_domain 替换成你自己的域名即可。< br > < strong > 重启nginx服务< / strong > < / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < span class = "line" > 2< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > $ systemctl nginx -t # nginx.conf 语法检查< / span > < br > < span class = "line" > $ systemctl restart nginx # 重启nginx< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > 然后大约经过10分钟,你就可以通过< code > https://你的域名< / code > 访问typecho了< / p >
< h2 id = "https配置" > < a href = "#https配置" class = "headerlink" title = "https配置" > < / a > https配置< / h2 > < p > 如果你任然无法访问,而是被引导到一个备案页面,那么你可能需要使用https< / p >
< h3 id = "法一" > < a href = "#法一" class = "headerlink" title = "法一" > < / a > 法一< / h3 > < p > 配置自动续费ssl证书可参考我的另一篇文章(< a href = "https://www.eee.dog/tech/ssl-auto-apply.html" > Centos7下 Nginx 配置ssl证书自动续期< / a > )< / p >
< h3 id = "法二" > < a href = "#法二" class = "headerlink" title = "法二" > < / a > 法二< / h3 > < ul >
< li > < p > 从腾讯云等申请并下载证书,然后上传nginx文件夹中的两个证书到服务器< / p >
< / li >
< li > < p > 去掉前面提到nginx.conf中第39,47-54行注释< / p >
< / li >
< li > < p > 将第47,48行后半部分分别换成你自己.crt和.key证书文件的地址< / p >
< / li >
< li > < p > < code > systemctl restart nginx< / code > 重启nginx< / p >
< / li >
< li > < p > 使用浏览器访问< code > https://你的域名< / code > < / p >
< / li >
< / ul >
< hr >
< p > 参考链接:< br > < a href = "https://www.cnblogs.com/blibli/p/7286786.html" target = "_blank" rel = "noopener" > https://www.cnblogs.com/blibli/p/7286786.html< / a > < br > < a href = "https://blog.csdn.net/weixin_41919236/article/details/84878430" target = "_blank" rel = "noopener" > https://blog.csdn.net/weixin_41919236/article/details/84878430< / a > < br > < a href = "https://www.cnblogs.com/moxiaoan/p/5683743.html" target = "_blank" rel = "noopener" > https://www.cnblogs.com/moxiaoan/p/5683743.html< / a > < br > < a href = "https://www.cnblogs.com/lalalagq/p/9979068.html?tdsourcetag=s_pcqq_aiomsg" target = "_blank" rel = "noopener" > https://www.cnblogs.com/lalalagq/p/9979068.html?tdsourcetag=s_pcqq_aiomsg< / a > < / p >
< / span >
< span class = ".en" >
< h2 id = "A-priori-condition" > < a href = "#A-priori-condition" class = "headerlink" title = "A priori condition" > < / a > A priori condition< / h2 > < ul >
< li > Only tested Alibaba Cloud Tencent Cloud Centos7 student machine< / li >
< li > The system is very clean, preferably just reinstalled< / li >
< li > Use root privileges< / li >
< / ul >
< h2 id = "A-key-installation" > < a href = "#A-key-installation" class = "headerlink" title = "A key installation" > < / a > A key installation< / h2 > < p > Boring to write a one-click build script, use the following commands to run (see < a href = "https://github.com/IoTcat/typecho-auto-install-centos7" target = "_blank" rel = "noopener" > github< / a > for details)< / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > $ wget https:/ / yimian-setup.obs.myhwclouds.com/ sh/ auto.sh & & sh auto.sh< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > If nothing happens, the installation will proceed automatically. At the end of the installation, you need to manually enter the following database configuration instructions.< / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < span class = "line" > 2< / span > < br > < span class = "line" > 3< / span > < br > < span class = "line" > 4< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > use mysql< / span > < br > < span class = "line" > UPDATE user SET Password = ' Your password' WHERE User = ' root' ;< / span > < br > < span class = "line" > create database typecho;< / span > < br > < span class = "line" > quit< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< h2 id = "Easy-start" > < a href = "#Easy-start" class = "headerlink" title = "Easy start" > < / a > Easy start< / h2 > < p > After the installation is complete, use your browser to visit the following link< / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > http:/ / your server ip< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > Install typecho according to the page prompt< br > Leave most of the content as default, just fill in:< / p >
< ul >
< li > Database password (the one you just set)< / li >
< li > Administrator username< / li >
< li > Administrator login password< / li >
< li > Administrator email address< / li >
< / ul >
< h2 id = "Custom-domain-configuration" > < a href = "#Custom-domain-configuration" class = "headerlink" title = "Custom domain configuration" > < / a > Custom domain configuration< / h2 > < p > First, resolve your domain name A to your server ip at your domain name service provider (Tencent Cloud, Alibaba Cloud)< br > < strong > Open the nginx configuration file on the server< / strong > < / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > $ vi / etc/ nginx/ nginx.conf< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > Just replace your_domain on lines 42, 47, and 48 in the file with your own domain name.< br > < strong > Restart nginx service< / strong > < / p >
< figure class = "highlight plain" > < table > < tr > < td class = "gutter" > < pre > < span class = "line" > 1< / span > < br > < span class = "line" > 2< / span > < br > < / pre > < / td > < td class = "code" > < pre > < span class = "line" > $ systemctl nginx -t # nginx.conf syntax check< / span > < br > < span class = "line" > $ systemctl restart nginx # restart nginx< / span > < br > < / pre > < / td > < / tr > < / table > < / figure >
< p > Then after about 10 minutes, you can access typecho via < code > https://your domain name< / code > < / p >
< h2 id = "https-configuration" > < a href = "#https-configuration" class = "headerlink" title = "https configuration" > < / a > https configuration< / h2 > < p > If you are still unable to access and are directed to a filing page, then you may need to use https< / p >
< h3 id = "Method-One" > < a href = "#Method-One" class = "headerlink" title = "Method One" > < / a > Method One< / h3 > < p > For configuring automatic renewal of ssl certificate, please refer to my other article (< a href = "https://www.eee.dog/tech/ssl-auto-apply.html" > Nginx under Centos7 configure ssl certificate automatic renewal< / a > )< / p >
< h3 id = "Method-two" > < a href = "#Method-two" class = "headerlink" title = "Method two" > < / a > Method two< / h3 > < ul >
< li > < p > Apply for and download a certificate from Tencent Cloud, etc., and then upload the two certificates in the nginx folder to the server< / p >
< / li >
< li > < p > Remove the comments on lines 39, 47-54 in nginx.conf mentioned earlier< / p >
< / li >
< li > < p > Replace the second half of lines 47 and 48 with the addresses of your own .crt and .key certificate files respectively< / p >
< / li >
< li > < p > < code > systemctl restart nginx< / code > restart nginx< / p >
< / li >
< li > < p > Use a browser to visit < code > https://your domain name< / code > < / p >
< / li >
< / ul >
< hr >
< p > Reference link:< br > < a href = "https://www.cnblogs.com/blibli/p/7286786.html" target = "_blank" rel = "noopener" > https://www.cnblogs.com/blibli/p/7286786.html< / a > < br > < a href = "https://blog.csdn.net/weixin_41919236/article/details/84878430" target = "_blank" rel = "noopener" > https://blog.csdn.net/weixin_41919236/article/details/84878430< / a > < br > < a href = "https://www.cnblogs.com/moxiaoan/p/5683743.html" target = "_blank" rel = "noopener" > https://www.cnblogs.com/moxiaoan/p/5683743.html< / a > < br > < a href = "https://www.cnblogs.com/lalalagq/p/9979068.html?tdsourcetag=s_pcqq_aiomsg" target = "_blank" rel = "noopener" > https://www.cnblogs.com/lalalagq/p/9979068.html?tdsourcetag=s_pcqq_aiomsg< / a > < / p >
< / span >
< / div >
< div class = "post-copyright" >
< p class = "copyright-item" >
< span > Author: < / span >
< a href = "https://iotcat.me/" target = "_blank" rel = "noopener" > IoTcat< / a >
< / p >
< p class = "copyright-item" >
< span > Link: < / span >
< a href = "https://www.eee.dog/tech/centos7-auto-install-typecho.html" > https://www.eee.dog/tech/centos7-auto-install-typecho.html< / a >
< / p >
< p class = "copyright-item" >
< span > License: < / span > < a rel = "license" href = "http://creativecommons.org/licenses/by-nc/4.0/" target = "_blank" > 知识共享署名-非商业性使用 4.0 国际许可协议< / a >
< / p >
< / div >
< footer class = "post-footer" >
< div class = "post-tags" >
< a href = "/tags/php/" > php< / a >
< a href = "/tags/centos7/" > centos7< / a >
< a href = "/tags/typecho/" > typecho< / a >
< / div >
< nav class = "post-nav" > < a class = "prev" href = "/tech/my-code-style.html" >
< i class = "iconfont icon-left" > < / i >
< span class = "prev-text nav-default" > < span class = ".zh" > 总结一下我的代码风格< / span > < span class = ".en" > Summarize my code style< / span > < / span >
< span class = "prev-text nav-mobile" > Prev< / span >
< / a >
< a class = "next" href = "/tech/cpp-summary.html" >
< span class = "next-text nav-default" > < span class = ".zh" > C++建库中遇到的坑< / span > < span class = ".en" > The pits encountered in C++ library building< / span > < / span >
< span class = "prev-text nav-mobile" > Next< / span >
< i class = "iconfont icon-right" > < / i >
< / a >
< / nav > < / footer >
< / article > < script > $ ( ( ) = > { v a r p = w i n d o w . l o c a t i o n . p a t h n a m e ; s e t T i m e o u t ( ( ) = > { i f ( w i n d o w . l o c a t i o n . p a t h n a m e = = p ) t i p s . s h o w ( {
title: 'tips',
position: 'topRight',
message: ((page.tran.getLang() == 'zh')?"此文章预计阅读 3 分钟哦~": "Read this page will spend around 6 minutes~")
})}, 6000)})< / script >
< / div > < div class = "comments" id = "comments" > < div id = "vcomments" > < / div >
< / div > < / div >
< / main >
< footer id = "footer" class = "footer" >
< script >
page_obj = {
layout: "post",
comments: "true"
};
< / script > < div class = "social-links" > < a href = "mailto:i@iotcat.me" class = "iconfont icon-email" title = "email" > < / a >
< a href = "https://github.com/iotcat" target = "_blank" rel = "noopener" class = "iconfont icon-github" title = "github" > < / a >
< a href = "/atom.xml" class = "iconfont icon-rss" title = "rss" > < / a >
< / div > < div class = "copyright" > < span id = "/tech/centos7-auto-install-typecho.html" class = "statistic leancloud_visitors" >
< em > Visitors < / em > < i class = "leancloud-visitors-count" > ??< / i >
< span class = "division" > |< / span >
< em > Reading < / em > 6 min
< / span >
< br >
< span class = "power-by" >
Powered by < a class = "hexo-link" href = "" onClick = "page.showUshio(`iotcat/eee.dog-blog`);" > Ushio< / a >
< / span >
< span class = "division" > |< / span >
< span class = "theme-info" >
Theme -
< a class = "theme-link" href = "https://github.com/iotcat/kayo" target = "_blank" rel = "noopener" > Kayo< / a >
< / span >
< span class = "copyright-year" > © 2018 - 2020< span class = "heart shaky" >
< i class = "iconfont icon-heart" > < / i >
< / span >
< span class = "author" > IoTcat< / span >
< / span >
< / div >
< / footer >
< div class = "back-to-top" id = "back-to-top" >
< i class = "iconfont icon-up" > < / i >
< / div >
< / div >
< script src = "https://cdn.yimian.xyz/kayo/lib/valine/valine.min.js" data-pjax > < / script >
< style >
/* 背景图片 */
#veditor {
background-image: url(https://cdn.jsdelivr.net/gh/drew233/cdn/20200409110727.webp);
background-size: contain;
background-repeat: no-repeat;
background-position: right;
background-color: rgba(255, 255, 255, 0);
resize: vertical
}
/* 头像旋转 */
img.vimg {
transition: all 1s /* 旋转时间为 1s */
}
img.vimg:hover {
transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
}
/* 盒子模式 */
#vcomments .vcards .vcard {
padding: 15px 20px 0 20px;
border-radius: 10px;
margin-bottom: 15px;
box-shadow: 0 0 4px 1px rgba(0, 0, 0, .12);
transition: all .3s
}
#vcomments .vcards .vcard:hover {
box-shadow: 0 0 8px 3px rgba(0, 0, 0, .12)
}
#vcomments .vcards .vcard .vh .vcard {
border: none;
box-shadow: none;
}
< / style >
< script >
pjax_valine = () => {
$.get('https://auth.yimian.xyz/getEmailHash.php', function(res){
if(page.tran.getLang() == 'zh'){
var lan = 'zh-CN';
var metaPlaceholder = {"nick":"昵称/QQ号","mail":"邮箱(完全保密)"};
var tagMeta = ["博主","小伙伴","访客"];
var placeholder = "填写邮箱可以及时收到回复哦(●'◡'●)";
}else{
var lan = 'en';
var metaPlaceholder = {"nick":"Nickname/QQ","mail":"EMail"};
var tagMeta = ["Master","Friend","Visitor"];
var placeholder = "Leave some comments here (●'◡'●)";
}
new Valine({
el: '#vcomments',
appId: 'eVzpK7EyT6OafJvXWIRminWT-gzGzoHsz',
appKey: '2qjuEBgVE0BscTQnTmoS9roU',
master: '9b616ff4cd6c305e5970bee7b1bd9b1f', //博主邮箱md5
tagMeta: tagMeta, //标识字段名
friends: res, //["b6ddef7c7e1c647e7767afeacdfb7b64","46dd4e6fef4f9591736c4723a965ca2e","6132d77f9f0ae060bc733090991acecb","3e00e104b79d7c6e866c6b23c6ba6dfc"], //小伙伴邮箱Md5
metaPlaceholder: metaPlaceholder,
placeholder: placeholder,
lang: lan,
path: window.location.pathname,
enableQQ: true,
visitor: true,
emojiCDN: '//i0.hdslb.com/bfs/emote/',
emojiMaps: {
"tv_doge": "6ea59c827c414b4a2955fe79e0f6fd3dcd515e24.png",
"tv_亲亲": "a8111ad55953ef5e3be3327ef94eb4a39d535d06.png",
"tv_偷笑": "bb690d4107620f1c15cff29509db529a73aee261.png",
"tv_再见": "180129b8ea851044ce71caf55cc8ce44bd4a4fc8.png",
"tv_冷漠": "b9cbc755c2b3ee43be07ca13de84e5b699a3f101.png",
"tv_发怒": "34ba3cd204d5b05fec70ce08fa9fa0dd612409ff.png",
"tv_发财": "34db290afd2963723c6eb3c4560667db7253a21a.png",
"tv_可爱": "9e55fd9b500ac4b96613539f1ce2f9499e314ed9.png",
"tv_吐血": "09dd16a7aa59b77baa1155d47484409624470c77.png",
"tv_呆": "fe1179ebaa191569b0d31cecafe7a2cd1c951c9d.png",
"tv_呕吐": "9f996894a39e282ccf5e66856af49483f81870f3.png",
"tv_困": "241ee304e44c0af029adceb294399391e4737ef2.png",
"tv_坏笑": "1f0b87f731a671079842116e0991c91c2c88645a.png",
"tv_大佬": "093c1e2c490161aca397afc45573c877cdead616.png",
"tv_大哭": "23269aeb35f99daee28dda129676f6e9ea87934f.png",
"tv_委屈": "d04dba7b5465779e9755d2ab6f0a897b9b33bb77.png",
"tv_害羞": "a37683fb5642fa3ddfc7f4e5525fd13e42a2bdb1.png",
"tv_尴尬": "7cfa62dafc59798a3d3fb262d421eeeff166cfa4.png",
"tv_微笑": "70dc5c7b56f93eb61bddba11e28fb1d18fddcd4c.png",
"tv_思考": "90cf159733e558137ed20aa04d09964436f618a1.png",
"tv_惊吓": "0d15c7e2ee58e935adc6a7193ee042388adc22af.png",
"tv_打脸": "56ab10b624063e966bfcb76ea5dc4794d87dfd47.png",
"tv_抓狂": "fe31c08edad661d63762b04e17b8d5ae3c71a757.png",
"tv_抠鼻": "c666f55e88d471e51bbd9fab9bb308110824a6eb.png",
"tv_斜眼笑": "911f987aa8bc1bee12d52aafe62bc41ef4474e6c.png",
"tv_无奈": "ea8ed89ee9878f2fece2dda0ea8a5dbfe21b5751.png",
"tv_晕": "5443c22b4d07fb1907ccc610c8e6db254f2461b7.png",
"tv_流汗": "cead1c351ab8d79e9f369605beb90148db0fbed3.png",
"tv_流泪": "7e71cde7858f0cd50d74b0264aa26db612a8a167.png",
"tv_流鼻血": "c32d39db2737f89b904ca32700d140a9241b0767.png",
"tv_点赞": "f85c354995bd99e28fc76c869bfe42ba6438eff4.png",
"tv_生气": "26702dcafdab5e8225b43ffd23c94ac1ff932654.png",
"tv_生病": "8b0ec90e6b86771092a498c54f09fc94621c1900.png",
"tv_疑问": "0793d949b18d7be716078349c202c15ff166f314.png",
"tv_白眼": "c1d59f439e379ee50eef488bcb5e5378e5044ea4.png",
"tv_皱眉": "72ccad6679fea0d14cce648b4d818e09b8ffea2d.png",
"tv_目瞪口呆": "0b8cb81a68de5d5365212c99375e7ace3e7891b7.png",
"tv_睡着": "8b196675b53af58264f383c50ad0945048290b33.png",
"tv_笑哭": "1abc628f6d4f4caf9d0e7800878f4697abbc8273.png",
"tv_腼腆": "89712c0d4af73e67f89e35cbc518420380a7f6f4.png",
"tv_色": "61822c7e9aae5da76475e7892534545336b23a6f.png",
"tv_调侃": "4bc022533ef31544ca0d72c12c808cf4a1cce3e3.png",
"tv_调皮": "b9c41de8e82dd7a8515ae5e3cb63e898bf245186.png",
"tv_鄙视": "6e72339f346a692a495b123174b49e4e8e781303.png",
"tv_闭嘴": "c9e990da7f6e93975e25fd8b70e2e290aa4086ef.png",
"tv_难过": "87f46748d3f142ebc6586ff58860d0e2fc8263ba.png",
"tv_馋": "fc7e829b845c43c623c8b490ee3602b7f0e76a31.png",
"tv_鬼脸": "0ffbbddf8a94d124ca2f54b360bbc04feb6bbfea.png",
"tv_黑人问号": "45821a01f51bc867da9edbaa2e070410819a95b2.png",
"tv_鼓掌": "1d21793f96ef4e6f48b23e53e3b9e42da833a0f6.png"
// ... 更多表情
}
});
});
};
< / script > < script type = "text/javascript" src = "https://cdn.yimian.xyz/ushio-js/ushio-footer.min.js" > < / script >
< script >
session.onload(function(){
if(session.get('group') != 'anonymous'){
function insertNick(){
if($('.vnick').length){
$('.vnick').val(session.get('nickname'));
}else{
setTimeout(insertNick, 500);
}
}
function insertMail(){
if($('.vmail').length){
$('.vmail').val(session.get('email'));
}else{
setTimeout(insertMail, 500);
}
}
if(session.get('nickname')){
insertNick();
}
if(session.get('email')){
insertMail();
}
}
});
< / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/lib/slideout/slideout.js" > < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/lib/fancybox/jquery.fancybox.pack.js" > < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/lib/iziToast/iziToast.min.js" > < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/lib/iziModal/iziModal.min.js" > < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/lib/mermaid/mermaid.min.js" > < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/js/src/kayo.js?v=1.0.0" data-pjax > < / script >
< script type = "text/javascript" src = "https://cdn.yimian.xyz/kayo/js/src/kayo-no-pjax.js?v=1.0.0" > < / script >
< script src = "https://cdn.yimian.xyz/kayo/lib/pjax/pjax.min.js" > < / script >
< script > w i n d o w . p j a x = n e w P j a x ( {
elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"])',
selectors: ["head title, #main", "#footer"],
});/* 第一次载入页面加载的函数 */
pjax_ini = () => {
/* 关闭侧边栏 */
window.slideout.close();
if(page_obj.comments == "true"){pjax_valine();}pjax_google_analytics();mermaid.init(undefined, $(".mermaid"));};
/* 第一次 执行 */
pjax_ini();var loadingBar = document.querySelector(".loading-bar");
var progress = document.querySelector(".loading-bar .progress");
var timer = null;
// Pjax 开始时执行的函数
var loadingbarStart = function () {
// 进度条默认已经加载 20%
var loadingBarWidth = 20;
// 进度条的最大增加宽度
var MAX_LOADING_WIDTH = 95;
// 显示进度条
loadingBar.classList.add("loading");
// 初始化进度条的宽度
progress.style.width = loadingBarWidth + "%";
clearInterval(timer);
timer = setInterval(function () {
// 进度条的增加速度(可以改为一个随机值,显得更加真实)
loadingBarWidth += 3;
// 当进度条到达 95% 后停止增加
if (loadingBarWidth > MAX_LOADING_WIDTH) {
loadingBarWidth = MAX_LOADING_WIDTH;
}
progress.style.width = loadingBarWidth + "%";
}, 500);
};
// Pjax 完成之后执行的函数
var loadingbarStop = function () {
clearInterval(timer);
progress.style.width = "100%";
loadingBar.classList.remove("loading");
setTimeout(function () {
progress.style.width = 0;
}, 400);
};/* Pjax 开始时,重新加载的函数 */
document.addEventListener("pjax:send", function () {loadingbarStart();
});
/* Pjax 完成后,重新加载的函数 */
document.addEventListener("pjax:complete", function () {
/* 重载带data-pjax的script,或者.pjax-reload属性内容的script */
$("script[data-pjax], .pjax-reload script").each(function () {
$(this).parent().append($(this).remove());
});
pjax_ini();loadingbarStop();
page.tran.setLang();
});
/* Pjax 出错,执行的函数 */
document.addEventListener("pjax:error", function () {
});< / script >
< / body >
< / html >