Windows系统下RuoYi-Vue(V3)部署概要记录

RuoYi-Vue部署概要

  • 前期准备
  • 项目部署
    • 下载源文件
    • 配置后端
      • 导入项目
      • 创建数据库并初始化数据
      • 配置application-druid.yml
      • 配置application.yml
      • 配置前端构建打包路径
      • 配置Nginx

前期准备

  1. 安装Node
  2. 安装redis
  3. 安装IntellJ
  4. 安装Webstorm
  5. 安装Mysql
  6. 注册git账户

项目部署

下载源文件

先cd到想要存放文件的路径

git clone https://gitee.com/y_project/RuoYi-Vue.git

配置后端

导入项目

创建数据库并初始化数据

创建数据库ry-vue,并导入数据脚本ry_20200920.sql,quartz.sql

配置application-druid.yml

master:url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8username: rootpassword: 自己的密码

配置application.yml

redis:# 地址host: localhost# 端口,默认为6379port: 6379# 密码password: 你的密码(也可以不设置)

配置前端构建打包路径

在下载包路径下:\RuoYi-Vue\ruoyi-ui,打开vue.config.js;
此处假设要把打包文件发布到nginx的路径:D:\soft\nginx-1.18.0\html\dist

module.exports = {// 部署生产环境和开发环境下的URL。// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。publicPath: process.env.NODE_ENV === "production" ? "/" : "/",// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)outputDir: 'D:\soft/nginx-1.18.0/html/dist',

注意把windows下路径的右划线改成左划线

配置Nginx

在nginx的安装路径\nginx-1.18.0\conf下,打开nginx.conf文件;


#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  1024;
}http {include       mime.types;default_type  application/octet-stream;#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       8088;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   \html\dist;try_files $uri $uri/ /index.html;   index  index.html index.html;}location /prod-api/{proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://localhost:8080/;}#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   html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {#    root           html;#    fastcgi_pass   127.0.0.1:9000;#    fastcgi_index  index.php;#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;#    include        fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}}
  • 启动com.ruoyi.RuoYiApplication.java


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部