You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1092 lines
42 KiB
1092 lines
42 KiB
6 years ago
|
|
||
|
<!DOCTYPE HTML>
|
||
|
<html lang="zh-hans" >
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||
|
<title>前端部署 · 调度系统-EasyScheduler</title>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
|
<meta name="description" content="">
|
||
|
<meta name="generator" content="GitBook 3.2.3">
|
||
|
<meta name="author" content="YIGUAN">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../gitbook/style.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo-link/plugin.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../styles/website.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<meta name="HandheldFriendly" content="true"/>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||
|
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||
|
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||
|
|
||
|
|
||
|
<link rel="next" href="deploy-foreground.html" />
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<div class="book">
|
||
|
<div class="book-summary">
|
||
|
|
||
|
|
||
|
<div id="book-search-input" role="search">
|
||
|
<input type="text" placeholder="输入并搜索" />
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<nav role="navigation">
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="summary">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.1" data-path="../">
|
||
|
|
||
|
<a href="../">
|
||
|
|
||
|
|
||
|
Easyscheduler简介
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2" >
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
导读指南
|
||
|
|
||
|
</span>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html">
|
||
|
|
||
|
|
||
|
系统架构分析
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.1" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#导语">
|
||
|
|
||
|
|
||
|
导语
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.2" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#背景">
|
||
|
|
||
|
|
||
|
背景
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.3" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#总架构设计">
|
||
|
|
||
|
|
||
|
总架构设计
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.4" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#中心化思想">
|
||
|
|
||
|
|
||
|
中心化思想
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.5" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#分布式锁实践">
|
||
|
|
||
|
|
||
|
分布式锁实践
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.6" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#线程不足循环等待问题">
|
||
|
|
||
|
|
||
|
线程不足循环等待问题
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.7" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#容错设计">
|
||
|
|
||
|
|
||
|
容错设计
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.8" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#日志访问">
|
||
|
|
||
|
|
||
|
Logback和gRPC实现日志访问
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1.9" data-path="guide-architecture.html">
|
||
|
|
||
|
<a href="guide-architecture.html#总结">
|
||
|
|
||
|
|
||
|
总结
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html">
|
||
|
|
||
|
|
||
|
使用手册
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.1" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#登录">
|
||
|
|
||
|
|
||
|
登录
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.2" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#安全中心">
|
||
|
|
||
|
|
||
|
安全中心
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.3" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#资源中心">
|
||
|
|
||
|
|
||
|
资源中心
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.4" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#数据源中心">
|
||
|
|
||
|
|
||
|
数据源中心
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.5" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#项目管理">
|
||
|
|
||
|
|
||
|
项目管理
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.6" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#首页">
|
||
|
|
||
|
|
||
|
站点首页
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.7" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#任务依赖">
|
||
|
|
||
|
|
||
|
任务依赖
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2.8" data-path="guide-manual.html">
|
||
|
|
||
|
<a href="guide-manual.html#系统参数">
|
||
|
|
||
|
|
||
|
系统参数
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3" >
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
项目部署文档
|
||
|
|
||
|
</span>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter active" data-level="1.3.1" data-path="deploy-foreground.html">
|
||
|
|
||
|
<a href="deploy-foreground.html">
|
||
|
|
||
|
|
||
|
前端部署
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.3.1.1" data-path="deploy-foreground.html">
|
||
|
|
||
|
<a href="deploy-foreground.html#前端项目环境构建及编译">
|
||
|
|
||
|
|
||
|
前端项目环境构建及编译
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.1.2" data-path="deploy-foreground.html">
|
||
|
|
||
|
<a href="deploy-foreground.html#安装及配置">
|
||
|
|
||
|
|
||
|
安装及配置
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.1.3" data-path="deploy-foreground.html">
|
||
|
|
||
|
<a href="deploy-foreground.html#项目生产环境配置">
|
||
|
|
||
|
|
||
|
项目生产环境Nginx配置
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.1.4" data-path="deploy-foreground.html">
|
||
|
|
||
|
<a href="deploy-foreground.html#前端项目发布">
|
||
|
|
||
|
|
||
|
前端项目发布
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.1.5" data-path="deploy-foreground.html">
|
||
|
|
||
|
<a href="deploy-foreground.html#问题">
|
||
|
|
||
|
|
||
|
问题
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html">
|
||
|
|
||
|
|
||
|
后端部署
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.1" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#基础软件安装">
|
||
|
|
||
|
|
||
|
基础软件安装
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.2" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#项目编译">
|
||
|
|
||
|
|
||
|
项目编译
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.3" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#数据库初始化">
|
||
|
|
||
|
|
||
|
数据库初始化
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.4" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#创建部署用户">
|
||
|
|
||
|
|
||
|
创建部署用户
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.5" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#配置文件">
|
||
|
|
||
|
|
||
|
配置文件
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.5.1" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#escheduler-alert">
|
||
|
|
||
|
|
||
|
escheduler-alert
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.5.2" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#escheduler-common">
|
||
|
|
||
|
|
||
|
escheduler-common
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.5.3" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#escheduler-dao">
|
||
|
|
||
|
|
||
|
escheduler-dao
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.5.4" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#escheduler-server">
|
||
|
|
||
|
|
||
|
escheduler-server
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.5.5" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#escheduler-web">
|
||
|
|
||
|
|
||
|
escheduler-web
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.6" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#启动停止命令">
|
||
|
|
||
|
|
||
|
启动停止命令
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.7" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#一键启停脚本">
|
||
|
|
||
|
|
||
|
一键启停脚本
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.8" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#监控服务">
|
||
|
|
||
|
|
||
|
监控服务
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2.9" data-path="deploy-background.html">
|
||
|
|
||
|
<a href="deploy-background.html#日志查看">
|
||
|
|
||
|
|
||
|
日志查看
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.4" >
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
前端开发文档
|
||
|
|
||
|
</span>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.4.1" data-path="foreground-2.html">
|
||
|
|
||
|
<a href="foreground-2.html">
|
||
|
|
||
|
|
||
|
安装
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.5" >
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
后端开发文档
|
||
|
|
||
|
</span>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.5.1" data-path="background-2.html">
|
||
|
|
||
|
<a href="background-2.html">
|
||
|
|
||
|
|
||
|
后端说明2
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<li class="divider"></li>
|
||
|
|
||
|
<li>
|
||
|
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||
|
本书使用 GitBook 发布
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="book-body">
|
||
|
|
||
|
<div class="body-inner">
|
||
|
|
||
|
|
||
|
|
||
|
<div class="book-header" role="navigation">
|
||
|
|
||
|
|
||
|
<!-- Title -->
|
||
|
<h1>
|
||
|
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||
|
<a href=".." >前端部署</a>
|
||
|
</h1>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="page-wrapper" tabindex="-1" role="main">
|
||
|
<div class="page-inner">
|
||
|
|
||
|
<div id="book-search-results">
|
||
|
<div class="search-noresults">
|
||
|
|
||
|
<section class="normal markdown-section">
|
||
|
|
||
|
<h1 id="前端部署文档">前端部署文档</h1>
|
||
|
<h2 id="前端项目环境构建及编译">前端项目环境构建及编译</h2>
|
||
|
<h4 id="escheduler项目前端技术栈">Escheduler项目前端技术栈</h4>
|
||
|
<h5 id="vue--es6--ans-ui--d3--jsplumb--lodash"><code>Vue + es6 + Ans-ui + d3 + jsplumb + lodash</code></h5>
|
||
|
<h4 id="开发环境">开发环境</h4>
|
||
|
<h5 id="node"><code>Node</code></h5>
|
||
|
<ul>
|
||
|
<li><h4 id="node安装">node安装</h4>
|
||
|
<p>Node包下载 (注意版本 8.9.4) <code>https://nodejs.org/download/release/v8.9.4/</code> </p>
|
||
|
</li>
|
||
|
<li><h4 id="拉取前端项目到本地">拉取前端项目到本地</h4>
|
||
|
<p>项目git仓库地址 <code>git@git.analysys.cn:analysys_changsha/escheduler.git</code></p>
|
||
|
</li>
|
||
|
<li><h4 id="前端项目构建">前端项目构建</h4>
|
||
|
<p>用命令行模式 <code>cd</code> 进入 <code>escheduler</code>项目目录并执行 <code>npm install</code> 拉取项目依赖包</p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<blockquote>
|
||
|
<p>如果 <code>npm install</code> 速度非常慢 </p>
|
||
|
<p>可以转淘宝镜像命令行输入 <code>npm install -g cnpm --registry=https://registry.npm.taobao.org</code></p>
|
||
|
<p>运行 <code>cnpm install</code> </p>
|
||
|
<h5 id="!!!这里特别注意-项目如果在拉取依赖包的过程中报--node-sass-error--错误,请在执行完后再次执行以下命令">!!!这里特别注意 项目如果在拉取依赖包的过程中报 " node-sass error " 错误,请在执行完后再次执行以下命令</h5>
|
||
|
<pre><code>npm install node-sass --unsafe-perm //单独安装node-sass依赖
|
||
|
</code></pre></blockquote>
|
||
|
<p>项目根目录创建<code>.env</code>为后缀名的文件并输入</p>
|
||
|
<pre><code># 前端代理的接口地址
|
||
|
API_BASE = http://192.168.220.204:12345
|
||
|
|
||
|
# 如果您需要用ip访问项目可以把 "#" 号去掉
|
||
|
#DEV_HOST = 192.168.6.132
|
||
|
</code></pre><p>运行</p>
|
||
|
<ul>
|
||
|
<li><p><code>npm start</code> 项目开发环境 (启动后访问地址 <a href="http://localhost:8888/#/" target="_blank">http://localhost:8888/#/</a>)</p>
|
||
|
</li>
|
||
|
<li><p><code>npm run build</code> 项目打包 (打包后根目录会创建一个名为dist文件夹,用于发布线上Nginx)</p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<h2 id="安装及配置">安装及配置</h2>
|
||
|
<h3 id="1-1-nginx安装">(1-1) Nginx安装</h3>
|
||
|
<p>安装 <code>wget http://nginx.org/download/nginx-1.10.1.tar.gz</code> </p>
|
||
|
<p>Nginx的配置及运行需要pcre、zlib等软件包的支持,因此应预先安装这些软件的开发包(devel),以便提供相应的库和头文件,确保Nginx的安装顺利完成。</p>
|
||
|
<pre><code>[root@nginx ~]# service iptables stop
|
||
|
[root@nginx ~]# setenforce 0
|
||
|
[root@nginx ~]# mount /dev/cdrom /mnt/
|
||
|
[root@nginx ~]# vim /etc/yum.repos.d/yum.repo
|
||
|
[base]
|
||
|
name=RedHat Enterprise Linux Server
|
||
|
baseurl=file:///mnt/Packages
|
||
|
gpgcheck=0
|
||
|
[root@nginx ~]# yum -y install pcre-devel zilb-devel openssl-devel
|
||
|
</code></pre><h3 id="1-2-创建运行用户、组">(1-2) 创建运行用户、组</h3>
|
||
|
<p>Nginx服务程序默认以nobody身份运行,建议为其创建专门的用户账号,以便更准确地控制其访问权限,增加灵活性、降低安全风险。如:创建一个名为nginx的用户,不建立宿主目录,也禁止登录到shell环境。</p>
|
||
|
<pre><code>[root@nginx ~]# useradd -M -s /sbin/nologin escheduler
|
||
|
</code></pre><h3 id="1-3-编译安装nginx">(1-3) 编译安装nginx</h3>
|
||
|
<p>释放nginx源码包</p>
|
||
|
<pre><code>[root@nginx ~]# tar xf nginx-1.6.2.tar.gz -C /usr/src/
|
||
|
</code></pre><p>编译前配置</p>
|
||
|
<pre><code>[root@nginx ~]# cd /usr/src/nginx-1.6.2/
|
||
|
[root@nginx nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --user=escheduler --group=escheduler --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
|
||
|
</code></pre><p>注:配置前可以参考 ./configure --help给出说明</p>
|
||
|
<pre><code>--prefix 设定Nginx的安装目录
|
||
|
--user和—group 指定Nginx运行用户和组
|
||
|
--with-http_stub_status_module 启用http_stub_status_module模块以支持状态统计
|
||
|
--with-http_ssl_module 启用SSL模块
|
||
|
</code></pre><blockquote>
|
||
|
<h4 id="错误">错误</h4>
|
||
|
<pre><code>[root@centos nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --user=escheduler --group=escheduler --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
|
||
|
checking for OS
|
||
|
+ Linux 2.6.32-431.el6.i686 i686
|
||
|
checking for C compiler ... not found
|
||
|
./configure: error: C compiler cc is not found
|
||
|
</code></pre><h4 id="解决方法">解决方法</h4>
|
||
|
<pre><code>yum -y install gcc gcc-c++
|
||
|
</code></pre></blockquote>
|
||
|
<p>编译 安装</p>
|
||
|
<pre><code>[root@nginx nginx-1.6.2]# make && make install
|
||
|
</code></pre><p>为了使Nginx服务器的运行更加方便,可以为主程序nginx创建链接文件,以便管理员直接执行nginx命令就可以调用Nginx的主程序。</p>
|
||
|
<pre><code>[root@nginx nginx-1.6.2]# ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/
|
||
|
[root@nginx nginx-1.6.2]# ll /usr/local/bin/nginx
|
||
|
lrwxrwxrwx 1 root root 27 12-29 07:24 /usr/local/bin/nginx -> /usr/local/nginx/sbin/nginx
|
||
|
</code></pre><p>Nginx的运行控制
|
||
|
与Apache的主程序httpd类似,Nginx的主程序也提供了"-t"选项用来对配置文件进行检查,以便找出不当或错误的配置。配置文件nginx.conf默认位于安装目录/usr/local/nginx/conf/目录中。若要检查位于其他位置的配置文件,可使用"-c"选项来指定路径。</p>
|
||
|
<pre><code>root@nginx conf]# nginx -t
|
||
|
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
|
||
|
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
|
||
|
</code></pre><p>启动、停止Nginx
|
||
|
直接运行nginx即可启动Nginx服务器,这种方式将使用默认的配置文件,若要改用其他配置文件,需添加"-c 配置文件路径"选项来指定路径。需要注意的是,若服务器中已安装有httpd等其他WEB服务软件,应采取措施(修改端口,停用或卸载)避免部突。</p>
|
||
|
<pre><code>[root@nginx conf]# chown -R escheduler:escheduler /usr/local/nginx
|
||
|
|
||
|
/usr/local/nginx/conf/nginx.conf
|
||
|
|
||
|
[root@nginx conf]# netstat -anpt |grep :80
|
||
|
[root@nginx conf]# nginx
|
||
|
[root@nginx conf]# netstat -anpt |grep :80
|
||
|
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6810/nginx: master
|
||
|
</code></pre><p>通过检查 Nginx程序的监听状态,或者在浏览器中访问此WEB服务(默认页面将显示"Welcome to nginx!"),可以确认Nginx服务是否正常运行。</p>
|
||
|
<pre><code>[root@nginx ~]# yum -y install elinks
|
||
|
[root@nginx ~]# elinks --dump http://localhost
|
||
|
Welcome to nginx!
|
||
|
</code></pre><p>主程序Nginx支持标准的进程信号,通过kill或者killall命令传送</p>
|
||
|
<pre><code>HUP 重载配置 等同于-1
|
||
|
QUIT 退出进程 等同于-3
|
||
|
KILL 杀死进程
|
||
|
[root@nginx ~]# killall -s HUP nginx
|
||
|
[root@nginx ~]# killall -s QUIT nginx
|
||
|
[root@nginx ~]# netstat -anpt |grep :80
|
||
|
</code></pre><p>当Nginx进程运行时,PID号默认存放在logs/目录下的nginx.pid文件中,因此若改用kill命令,也可以根据nginx.pid文件中的PID号来进行控制。
|
||
|
为了使Nginx服务的启动、停止、重载等操作更加方便,可以编写Nginx服务脚本,并使用chkconfig和service工具来进行管理,也更加符合RHEL系统的管理习惯。</p>
|
||
|
<pre><code>[root@nginx ~]# vim /etc/init.d/nginx
|
||
|
</code></pre><p>脚本一</p>
|
||
|
<pre><code>#!/bin/bash
|
||
|
# chkconfig: 2345 99 20
|
||
|
# description: Nginx Server Control Script
|
||
|
PROG="/usr/local/nginx/sbin/nginx"
|
||
|
PIDF="/usr/local/nginx/logs/nginx.pid"
|
||
|
case "$1" in
|
||
|
start)
|
||
|
$PROG
|
||
|
;;
|
||
|
stop)
|
||
|
kill -s QUIT $(cat $PIDF)
|
||
|
;;
|
||
|
restart)
|
||
|
$0 stop
|
||
|
$0 start
|
||
|
;;
|
||
|
reload)
|
||
|
kill -s HUP $(cat $PIDF)
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage: $0 (start|stop|restart|reload)"
|
||
|
exit 1
|
||
|
esac
|
||
|
exit 0
|
||
|
|
||
|
[root@nginx ~]# chmod +x /etc/init.d/nginx
|
||
|
[root@nginx ~]# chkconfig --add nginx
|
||
|
[root@nginx ~]# chkconfig nginx on
|
||
|
[root@nginx ~]# chkconfig --list nginx
|
||
|
nginx 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
|
||
|
</code></pre><p>报错的话: <code>/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf</code></p>
|
||
|
<p>这样就可以通过nginx脚本来启动、停止、重启、重载Nginx服务器了。</p>
|
||
|
<h3 id="2-1-root安装">(2-1) root安装</h3>
|
||
|
<p>安装epel源 <code>yum install epel-release -y</code></p>
|
||
|
<p>安装Nginx <code>yum install nginx -y</code></p>
|
||
|
<h4 id="命令">命令</h4>
|
||
|
<ul>
|
||
|
<li><p>启用 <code>systemctl enable nginx</code></p>
|
||
|
</li>
|
||
|
<li><p>重启 <code>systemctl restart nginx</code></p>
|
||
|
</li>
|
||
|
<li><p>状态 <code>systemctl status nginx</code></p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<h1 id="项目生产环境配置">项目生产环境配置</h1>
|
||
|
<blockquote>
|
||
|
<h4 id="创建静态页面存放目录">创建静态页面存放目录</h4>
|
||
|
<pre><code>mkdir /data2_4T/escheduler_front/escheduler/server
|
||
|
</code></pre><h4 id="配置文件地址">配置文件地址</h4>
|
||
|
<pre><code>/etc/nginx/conf.d/default.conf
|
||
|
</code></pre><h4 id="配置信息">配置信息</h4>
|
||
|
<pre><code>server {
|
||
|
listen 8888;# 访问端口
|
||
|
server_name localhost;
|
||
|
#charset koi8-r;
|
||
|
#access_log /var/log/nginx/host.access.log main;
|
||
|
location / {
|
||
|
root /data2_4T/escheduler_front/escheduler/server; # 静态文件目录
|
||
|
index index.html index.html;
|
||
|
}
|
||
|
location /escheduler {
|
||
|
proxy_pass http://192.168.220.181:12345; # 接口地址
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
proxy_set_header x_real_ipP $remote_addr;
|
||
|
proxy_set_header remote_addr $remote_addr;
|
||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
proxy_http_version 1.1;
|
||
|
proxy_connect_timeout 4s;
|
||
|
proxy_read_timeout 30s;
|
||
|
proxy_send_timeout 12s;
|
||
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
proxy_set_header Connection "upgrade";
|
||
|
}
|
||
|
#error_page 404 /404.html;
|
||
|
# redirect server error pages to the static page /50x.html
|
||
|
#
|
||
|
error_page 500 502 503 504 /50x.html;
|
||
|
location = /50x.html {
|
||
|
root /usr/share/nginx/html;
|
||
|
}
|
||
|
}
|
||
|
</code></pre><h4 id="重启nginx服务">重启Nginx服务</h4>
|
||
|
<pre><code>systemctl restart nginx
|
||
|
</code></pre></blockquote>
|
||
|
<h2 id="前端项目发布">前端项目发布</h2>
|
||
|
<p>前端在开发环境(dev)中运行 <code>npm run build</code> 命令,生成打包文件(dist)包</p>
|
||
|
<p>再拷贝到服务器 <code>/data2_4T/escheduler_front/escheduler/server</code>(服务器静态页面存放目录)</p>
|
||
|
<p>访问地址 <code>http://localhost:8888/#/</code> </p>
|
||
|
<h2 id="问题">问题</h2>
|
||
|
<h4 id="1-上传文件大小限制">1. 上传文件大小限制</h4>
|
||
|
<p>编辑配置文件 <code>vi /etc/nginx/nginx.conf</code></p>
|
||
|
<pre><code># 更改上传大小
|
||
|
client_max_body_size 1024m
|
||
|
</code></pre>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
</div>
|
||
|
<div class="search-results">
|
||
|
<div class="has-results">
|
||
|
|
||
|
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||
|
<ul class="search-results-list"></ul>
|
||
|
|
||
|
</div>
|
||
|
<div class="no-results">
|
||
|
|
||
|
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<a href="deploy-foreground.html#前端项目环境构建及编译" class="navigation navigation-next navigation-unique" aria-label="Next page: 前端项目环境构建及编译">
|
||
|
<i class="fa fa-angle-right"></i>
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
var gitbook = gitbook || [];
|
||
|
gitbook.push(function() {
|
||
|
gitbook.page.hasChanged({"page":{"title":"前端部署","level":"1.3.1","depth":2,"next":{"title":"前端项目环境构建及编译","level":"1.3.1.1","depth":3,"anchor":"#前端项目环境构建及编译","path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md#前端项目环境构建及编译","articles":[]},"previous":{"title":"项目部署文档","level":"1.3","depth":1,"ref":"","articles":[{"title":"前端部署","level":"1.3.1","depth":2,"path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md","articles":[{"title":"前端项目环境构建及编译","level":"1.3.1.1","depth":3,"anchor":"#前端项目环境构建及编译","path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md#前端项目环境构建及编译","articles":[]},{"title":"安装及配置","level":"1.3.1.2","depth":3,"anchor":"#安装及配置","path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md#安装及配置","articles":[]},{"title":"项目生产环境Nginx配置","level":"1.3.1.3","depth":3,"anchor":"#项目生产环境配置","path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md#项目生产环境配置","articles":[]},{"title":"前端项目发布","level":"1.3.1.4","depth":3,"anchor":"#前端项目发布","path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md#前端项目发布","articles":[]},{"title":"问题","level":"1.3.1.5","depth":3,"anchor":"#问题","path":"pages/deploy-foreground.md","ref":"pages/deploy-foreground.md#问题","articles":[]}]},{"title":"后端部署","level":"1.3.2","depth":2,"path":"pages/deploy-background.md","ref":"pages/deploy-background.md","articles":[{"title":"基础软件安装","level":"1.3.2.1","depth":3,"anchor":"#基础软件安装","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#基础软件安装","articles":[]},{"title":"项目编译","level":"1.3.2.2","depth":3,"anchor":"#项目编译","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#项目编译","articles":[]},{"title":"数据库初始化","level":"1.3.2.3","depth":3,"anchor":"#数据库初始化","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#数据库初始化","articles":[]},{"title":"创建部署用户","level":"1.3.2.4","depth":3,"anchor":"#创建部署用户","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#创建部署用户","articles":[]},{"title":"配置文件","level":"1.3.2.5","depth":3,"anchor":"#配置文件","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#配置文件","articles":[{"title":"escheduler-alert","level":"1.3.2.5.1","depth":4,"anchor":"#escheduler-alert","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#escheduler-alert","articles":[]},{"title":"escheduler-common","level":"1.3.2.5.2","depth":4,"anchor":"#escheduler-common","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#escheduler-common","articles":[]},{"title":"escheduler-dao","level":"1.3.2.5.3","depth":4,"anchor":"#escheduler-dao","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#escheduler-dao","articles":[]},{"title":"escheduler-server","level":"1.3.2.5.4","depth":4,"anchor":"#escheduler-server","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#escheduler-server","articles":[]},{"title":"escheduler-web","level":"1.3.2.5.5","depth":4,"anchor":"#escheduler-web","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#escheduler-web","articles":[]}]},{"title":"启动停止命令","level":"1.3.2.6","depth":3,"anchor":"#启动停止命令","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#启动停止命令","articles":[]},{"title":"一键启停脚本","level":"1.3.2.7","depth":3,"anchor":"#一键启停脚本","path":"pages/deploy-background.md","ref":"pages/deploy-background.md#一键启停脚本","articles":[]},{"title":"监控服务","level":"1.3.2.8","depth":3,"anchor":"#监控服务","path":"pages/deploy-background.md","ref":"pages/deploy-background
|
||
|
});
|
||
|
</script>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook.js"></script>
|
||
|
<script src="../gitbook/theme.js"></script>
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-insert-logo-link/plugin.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
|