deploy.html 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <meta name="generator" content="VuePress 2.0.0-beta.53">
  7. <style>
  8. :root {
  9. --c-bg: #fff;
  10. }
  11. html.dark {
  12. --c-bg: #22272e;
  13. }
  14. html, body {
  15. background-color: var(--c-bg);
  16. }
  17. </style>
  18. <script>
  19. const userMode = localStorage.getItem('vuepress-color-scheme');
  20. const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
  21. if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
  22. document.documentElement.classList.toggle('dark', true);
  23. }
  24. </script>
  25. <title>6. 项目部署 | 学之思教程</title><meta name="description" content="学之思开发部署教程">
  26. <link rel="preload" href="/xzs-mysql/assets/style.dc49a209.css" as="style" /><link rel="stylesheet" href="/xzs-mysql/assets/style.dc49a209.css" />
  27. <link rel="modulepreload" href="/xzs-mysql/assets/app.da7e9a43.js"><link rel="modulepreload" href="/xzs-mysql/assets/deploy.html.6fc9007d.js"><link rel="modulepreload" href="/xzs-mysql/assets/deploy.html.c0cb4b0b.js"><link rel="prefetch" href="/xzs-mysql/assets/index.html.9914953e.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/admin.html.52552ef2.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/database.html.d0f44a34.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/develop.html.2080e0b6.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/feature.html.261d99f8.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/skill.html.f2c35381.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/student.html.8f0ddefe.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/video.html.dba570b1.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/wx.html.ddd4b957.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/404.html.c3e557d0.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/index.html.2d56b715.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/admin.html.618069aa.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/database.html.dc62ffad.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/develop.html.32dc793d.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/feature.html.434dcfa8.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/skill.html.2e0839d0.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/student.html.e7a341ff.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/video.html.2da548af.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/wx.html.79345989.js" as="script" /><link rel="prefetch" href="/xzs-mysql/assets/404.html.98ff3f2e.js" as="script" />
  28. </head>
  29. <body>
  30. <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="/xzs-mysql/" 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="/xzs-mysql/guide/feature.html" class="sidebar-item" aria-label="1. 功能列表"><!--[--><!--]--> 1. 功能列表 <!--[--><!--]--></a><!----></li><li><a href="/xzs-mysql/guide/skill.html" class="sidebar-item" aria-label="2. 技术栈"><!--[--><!--]--> 2. 技术栈 <!--[--><!--]--></a><!----></li><li><a href="/xzs-mysql/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="/xzs-mysql/guide/student.html" class="sidebar-item" aria-label="4.1 学生端"><!--[--><!--]--> 4.1 学生端 <!--[--><!--]--></a><!----></li><li><a href="/xzs-mysql/guide/wx.html" class="sidebar-item" aria-label="4.2 小程序"><!--[--><!--]--> 4.2 小程序 <!--[--><!--]--></a><!----></li><li><a href="/xzs-mysql/guide/admin.html" class="sidebar-item" aria-label="4.3 管理端"><!--[--><!--]--> 4.3 管理端 <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a href="/xzs-mysql/guide/develop.html" class="sidebar-item" aria-label="5. 项目开发"><!--[--><!--]--> 5. 项目开发 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/xzs-mysql/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="/xzs-mysql/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="/xzs-mysql/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="/xzs-mysql/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="/xzs-mysql/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>分别在\source\vue\xzs-student目录和source\vue\xzs-admin目录,执行前端打包命令</li></ul><div class="language-npm line-numbers-mode" data-ext="npm"><pre class="language-npm"><code>npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
  31. npm install --registry https://registry.npm.taobao.org
  32. npm run build
  33. </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></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 line-numbers-mode" data-ext="java"><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>
  34. </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 line-numbers-mode" data-ext="nginx"><pre class="language-nginx"><code><span class="token directive"><span class="token keyword">server</span></span> <span class="token punctuation">{</span>
  35. <span class="token directive"><span class="token keyword">listen</span> <span class="token number">8001</span></span><span class="token punctuation">;</span>
  36. <span class="token directive"><span class="token keyword">server_name</span> xzs</span><span class="token punctuation">;</span>
  37. <span class="token directive"><span class="token keyword">location</span> /</span> <span class="token punctuation">{</span>
  38. <span class="token directive"><span class="token keyword">root</span> /usr/local/xzs/web/</span><span class="token punctuation">;</span>
  39. <span class="token directive"><span class="token keyword">index</span> index.html</span><span class="token punctuation">;</span>
  40. <span class="token punctuation">}</span>
  41. <span class="token directive"><span class="token keyword">location</span> /api/</span> <span class="token punctuation">{</span>
  42. <span class="token directive"><span class="token keyword">proxy_pass</span> http://localhost:8000</span><span class="token punctuation">;</span>
  43. <span class="token punctuation">}</span>
  44. <span class="token punctuation">}</span>
  45. </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 line-numbers-mode" data-ext="xzs-mysql"><pre class="language-xzs-mysql"><code>CREATE DATABASE `xzs` CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
  46. USE xzs;
  47. </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 line-numbers-mode" data-ext="docker-compose"><pre class="language-docker-compose"><code>cd /usr/local/xzs/install
  48. mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
  49. chmod +x /usr/local/bin/docker-compose
  50. docker-compose --version
  51. </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 line-numbers-mode" data-ext="docker-xzs"><pre class="language-docker-xzs"><code>cd /usr/local/xzs
  52. docker-compose up -d
  53. </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="/xzs-mysql/guide/develop.html" class="" aria-label="5. 项目开发"><!--[--><!--]--> 5. 项目开发 <!--[--><!--]--></a></span><span class="next"><a href="/xzs-mysql/guide/video.html" class="" aria-label="7. 视频教程"><!--[--><!--]--> 7. 视频教程 <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
  54. <script type="module" src="/xzs-mysql/assets/app.da7e9a43.js" defer></script>
  55. </body>
  56. </html>