Files
xzs-mysql/docs/guide/deploy.html
T
2026-03-24 08:32:17 +08:00

57 lines
28 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="VuePress 2.0.0-beta.51">
<style>
:root {
--c-bg: #fff;
}
html.dark {
--c-bg: #22272e;
}
html, body {
background-color: var(--c-bg);
}
</style>
<script>
const userMode = localStorage.getItem('vuepress-color-scheme');
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
document.documentElement.classList.toggle('dark', true);
}
</script>
<title>6. 项目部署 | 学之思教程</title><meta name="description" content="学之思开发部署教程">
<link rel="modulepreload" href="/assets/app.9bcb8e6f.js"><link rel="modulepreload" href="/assets/deploy.html.efd62c6a.js"><link rel="modulepreload" href="/assets/deploy.html.3556abb5.js"><link rel="prefetch" href="/assets/index.html.fe66c5d6.js"><link rel="prefetch" href="/assets/admin.html.95aff702.js"><link rel="prefetch" href="/assets/database.html.d0f44a34.js"><link rel="prefetch" href="/assets/develop.html.70367536.js"><link rel="prefetch" href="/assets/feature.html.261d99f8.js"><link rel="prefetch" href="/assets/skill.html.a2155b8b.js"><link rel="prefetch" href="/assets/student.html.e082e38b.js"><link rel="prefetch" href="/assets/video.html.223c0851.js"><link rel="prefetch" href="/assets/wx.html.0df5ac91.js"><link rel="prefetch" href="/assets/404.html.c3e557d0.js"><link rel="prefetch" href="/assets/index.html.c2023034.js"><link rel="prefetch" href="/assets/admin.html.9bedd851.js"><link rel="prefetch" href="/assets/database.html.9ce276fe.js"><link rel="prefetch" href="/assets/develop.html.a56e7536.js"><link rel="prefetch" href="/assets/feature.html.74ad23ac.js"><link rel="prefetch" href="/assets/skill.html.d93504a9.js"><link rel="prefetch" href="/assets/student.html.2916fc76.js"><link rel="prefetch" href="/assets/video.html.7a78ae78.js"><link rel="prefetch" href="/assets/wx.html.9ecfe276.js"><link rel="prefetch" href="/assets/404.html.c467b474.js">
<link rel="stylesheet" href="/assets/style.e2da3676.css">
</head>
<body>
<div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/" class=""><img class="logo" src="https://www.mindskip.net/style/git/images/logo/logo.png" alt="学之思教程"><span class="site-name can-hide">学之思教程</span></a></span><div class="navbar-items-wrapper" style=""><!--[--><!--]--><nav class="navbar-items can-hide"><!--[--><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net" rel="noopener noreferrer" target="_blank" aria-label="官网"><!--[--><!--]--> 官网 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/sdd.html" rel="noopener noreferrer" target="_blank" aria-label="思多多"><!--[--><!--]--> 思多多 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/wdd.html" rel="noopener noreferrer" target="_blank" aria-label="维多多"><!--[--><!--]--> 维多多 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/xzs.html" rel="noopener noreferrer" target="_blank" aria-label="学之思"><!--[--><!--]--> 学之思 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/buy.html" rel="noopener noreferrer" target="_blank" aria-label="商业购买"><!--[--><!--]--> 商业购买 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-color-mode-button" title="toggle color mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-items"><!--[--><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net" rel="noopener noreferrer" target="_blank" aria-label="官网"><!--[--><!--]--> 官网 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/sdd.html" rel="noopener noreferrer" target="_blank" aria-label="思多多"><!--[--><!--]--> 思多多 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/wdd.html" rel="noopener noreferrer" target="_blank" aria-label="维多多"><!--[--><!--]--> 维多多 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/xzs.html" rel="noopener noreferrer" target="_blank" aria-label="学之思"><!--[--><!--]--> 学之思 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://www.mindskip.net/buy.html" rel="noopener noreferrer" target="_blank" aria-label="商业购买"><!--[--><!--]--> 商业购买 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-items"><!--[--><li><p tabindex="0" class="sidebar-item sidebar-heading active"> <!----></p><ul style="" class="sidebar-item-children"><!--[--><li><a href="/guide/feature.html" class="sidebar-item" aria-label="1. 功能列表"><!--[--><!--]--> 1. 功能列表 <!--[--><!--]--></a><!----></li><li><a href="/guide/skill.html" class="sidebar-item" aria-label="2. 技术栈"><!--[--><!--]--> 2. 技术栈 <!--[--><!--]--></a><!----></li><li><a href="/guide/database.html" class="sidebar-item" aria-label="3. 数据库设计"><!--[--><!--]--> 3. 数据库设计 <!--[--><!--]--></a><!----></li><li><p tabindex="0" class="sidebar-item">4. 接口文档 <!----></p><ul style="" class="sidebar-item-children"><!--[--><li><a href="/guide/student.html" class="sidebar-item" aria-label="4.1 学生端"><!--[--><!--]--> 4.1 学生端 <!--[--><!--]--></a><!----></li><li><a href="/guide/wx.html" class="sidebar-item" aria-label="4.2 小程序"><!--[--><!--]--> 4.2 小程序 <!--[--><!--]--></a><!----></li><li><a href="/guide/admin.html" class="sidebar-item" aria-label="4.3 管理端"><!--[--><!--]--> 4.3 管理端 <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a href="/guide/develop.html" class="sidebar-item" aria-label="5. 项目开发"><!--[--><!--]--> 5. 项目开发 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/guide/deploy.html" class="router-link-active router-link-exact-active router-link-active sidebar-item active" aria-label="6. 项目部署"><!--[--><!--]--> 6. 项目部署 <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/guide/deploy.html#_6-1-集成部署" class="router-link-active router-link-exact-active sidebar-item" aria-label="6.1 集成部署"><!--[--><!--]--> 6.1 集成部署 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/guide/deploy.html#_6-2-前后端分离部署" class="router-link-active router-link-exact-active sidebar-item" aria-label="6.2 前后端分离部署"><!--[--><!--]--> 6.2 前后端分离部署 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/guide/deploy.html#_6-3-docker部署" class="router-link-active router-link-exact-active sidebar-item" aria-label="6.3 docker部署"><!--[--><!--]--> 6.3 docker部署 <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a href="/guide/video.html" class="sidebar-item" aria-label="7. 视频教程"><!--[--><!--]--> 7. 视频教程 <!--[--><!--]--></a><!----></li><!--]--></ul></li><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><!--]--><div><h1 id="_6-项目部署" tabindex="-1"><a class="header-anchor" href="#_6-项目部署" aria-hidden="true">#</a> 6. 项目部署</h1><h3 id="_6-1-集成部署" tabindex="-1"><a class="header-anchor" href="#_6-1-集成部署" aria-hidden="true">#</a> 6.1 集成部署</h3><ul><li>安装node16,下载地址:<a href="https://nodejs.org/download/release/latest-v16.x" target="_blank" rel="noopener noreferrer">https://nodejs.org/download/release/latest-v16.x<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li><li>前端使用webstorm或者vscode,分别打开文件夹打开源代码\source\vue\xzs-student和source\vue\xzs-admin</li><li>执行下面2个命令,下载项目的node_module</li></ul><div class="language-npm ext-npm line-numbers-mode"><pre class="language-npm"><code>npm config set sass_binary_site https://registry.npmmirror.com
npm install --registry https://registry.npmmirror.com
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>若执行上面命令报错,先删除node_modules文件夹,再解压node_modules.zip压缩包到当前文件夹。</li><li>打包命令</li></ul><div class="language-npm ext-npm line-numbers-mode"><pre class="language-npm"><code>npm run build
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>打包后的目录为student和admin</li><li>将文件放到\source\xzs\src\main\resources\static下,然后将java程序打包成jar包</li><li>修改application-prod.yml中的datasource地址</li><li>学生端访问地址为:<a href="http://ip:8000/student" target="_blank" rel="noopener noreferrer">http://ip:8000/student<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li><li>管理员端访问地址为:<a href="http://ip:8000/admin" target="_blank" rel="noopener noreferrer">http://ip:8000/admin<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li><li>执行下列命令,运行程序</li></ul><div class="language-java ext-java line-numbers-mode"><pre class="language-java"><code>nohup java <span class="token operator">-</span><span class="token class-name">Duser</span><span class="token punctuation">.</span>timezone<span class="token operator">=</span><span class="token class-name">Asia</span><span class="token operator">/</span><span class="token class-name">Shanghai</span> <span class="token operator">-</span>jar <span class="token operator">-</span><span class="token class-name">Dspring</span><span class="token punctuation">.</span>profiles<span class="token punctuation">.</span>active<span class="token operator">=</span>prod xzs<span class="token operator">-</span><span class="token number">3.9</span><span class="token number">.0</span><span class="token punctuation">.</span>jar <span class="token operator">&gt;</span> start1<span class="token punctuation">.</span>log <span class="token number">2</span><span class="token operator">&gt;</span><span class="token operator">&amp;</span><span class="token number">1</span> <span class="token operator">&amp;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="_6-2-前后端分离部署" tabindex="-1"><a class="header-anchor" href="#_6-2-前后端分离部署" aria-hidden="true">#</a> 6.2 前后端分离部署</h3><ul><li>采用前后端分离方式部署,后端启动和部署方式1一样</li><li>前端采用nginx来装载静态页面,先创建/usr/local/xzs/web/目录,然后将打包后的student、admin放到此目录下</li><li>页面访问端口为8001,注意检查防火墙端口是否打开</li><li>学生端访问地址为:<a href="http://ip:8001/student" target="_blank" rel="noopener noreferrer">http://ip:8001/student<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li><li>管理员端访问地址为:<a href="http://ip:8001/admin" target="_blank" rel="noopener noreferrer">http://ip:8001/admin<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li><li>nginx配置如下:</li></ul><div class="language-nginx ext-nginx line-numbers-mode"><pre class="language-nginx"><code><span class="token directive"><span class="token keyword">server</span></span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">listen</span> <span class="token number">8001</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">server_name</span> xzs</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">location</span> /</span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">root</span> /usr/local/xzs/web/</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">index</span> index.html</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token directive"><span class="token keyword">location</span> /api/</span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">proxy_pass</span> http://localhost:8000</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="_6-3-docker部署" tabindex="-1"><a class="header-anchor" href="#_6-3-docker部署" aria-hidden="true">#</a> 6.3 docker部署</h3><ul><li>打开网站<a href="https://gitee.com/mindskip/xzs-mysql" target="_blank" rel="noopener noreferrer">https://gitee.com/mindskip/xzs-mysql<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>,找到docker目录,里面有已配置好的文件</li><li>下载sql脚本,下载教程<a href="https://www.mindskip.net:999" target="_blank" rel="noopener noreferrer">https://www.mindskip.net:999<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>,然后解压sql压缩包,找到xzs-mysql.sql文件,编辑此文件,在文件开头加如下代码:</li></ul><div class="language-xzs-mysql ext-xzs-mysql line-numbers-mode"><pre class="language-xzs-mysql"><code>CREATE DATABASE `xzs` CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
USE xzs;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>sql文件改好后,将文件移动到 docker/sql 目录下</li><li>将整个docker目录中的文件,复制到/usr/local/xzs下面</li><li>进入到install目录,执行下面命令,安装docker-compose</li></ul><div class="language-docker-compose ext-docker-compose line-numbers-mode"><pre class="language-docker-compose"><code>cd /usr/local/xzs/install
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>执行下面命令,启动学之思网站,有问题可以看下/usr/local/xzs/log中的日志</li></ul><div class="language-docker-xzs ext-docker-xzs line-numbers-mode"><pre class="language-docker-xzs"><code>cd /usr/local/xzs
docker-compose up -d
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>学生端访问地址为:<a href="http://ip:8000/student" target="_blank" rel="noopener noreferrer">http://ip:8000/student<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li><li>管理员端访问地址为:<a href="http://ip:8000/admin" target="_blank" rel="noopener noreferrer">http://ip:8000/admin<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></li></ul></div><!--[--><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><!----></div><div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: mindskip@qq.com">mindskip</span><!--[-->, <!--]--><!--]--><!--[--><span class="contributor" title="email: mindskip@qq.com">思维跳跃科技</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"><a href="/guide/develop.html" class="" aria-label="5. 项目开发"><!--[--><!--]--> 5. 项目开发 <!--[--><!--]--></a></span><span class="next"><a href="/guide/video.html" class="" aria-label="7. 视频教程"><!--[--><!--]--> 7. 视频教程 <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
<script type="module" src="/assets/app.9bcb8e6f.js" defer></script>
</body>
</html>