Article Directory
- A local ready
- 1. clone projects to the local
- 2. The front-end project
- 3. The rear end of the project
- 4. nginx configuration file
- Two, Centos7 environment preparation
- 2.1. Installation and start mysql
- 2.2. Installation and start redis
- 2.3. Nginx installation and configuration files nginx.conf
- Third, testing and certification
A local ready
1. clone projects to the local
git clone git@gitee.com:y_project/RuoYi-Vue.git
2. The front-end project
#进入前端项目
cd C:\Users\Administrator\Desktop\RuoYi-Vue\ruoyi-ui
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# 安装依赖
npm install
# 构建生产环境
npm run build:prod
NOTE: After the completion of the execution ruoyi-ui folder created beneath
a folder dist
3. The rear end of the project
#进入后端项目目录
cd C:\Users\Administrator\Desktop\RuoYi-Vue\ruoyi
#maven编译打包
mvn clean install -DskipTests
Note: After the completion of the implementation in C: \ Users \ Administrator \ Desktop \ RuoYi-Vue \ ruoyi \ target \ folder below will generate
a file ruoyi.jar
4. nginx configuration file
See Annex: Finally
Need to modify the place I marked in red
Two, Centos7 environment preparation
2.1. Installation and start mysql
https://gblfy.blog.csdn.net/article/details/90545281
2.2. Installation and start redis
https://gblfy.blog.csdn.net/article/details/105375202
2.3. Nginx installation and configuration files nginx.conf
https://gblfy.blog.csdn.net/article/details/105375345
After installation is complete, then the configuration nginx.conf
file
Online yum install nginx middleware, nginx.conf files by default in
cd /etc/nginx
the following directory, copy prepared nginx.conf
directly
take cover, then you can restart nginx
Provided that: the configuration has been modified in the specified directory good
Third, testing and certification
3.1. Prepared files uploaded
Case presentation:
I ruoyi.jar和dist
have put /app
the following
to start the back-end projects, in order to facilitate monitoring logs, temporary use of the reception start
3.2. Start back-end project
java -jar ruoyi.jar
Attach: Background start:nohup java -jar ruoyi.jar &
See specific configuration: https://gblfy.blog.csdn.net/article/details/103741182
3.3. Login authentication.
Note: If the login page does not display the code, it is recommended to view redis is enough already started!
Accompanied by a full nginx configuration file
#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 80;
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.htm;
}
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;
# }
#}
}