编译工具
IDEA2020.1.3
navicat15
xshell远程链接工具
xshell FTP
本地安装nodejs、yarn
centOS 7.x
centOS 安装JDK1.8
centOS安装nginx
nginx需配置,在etc/nginx/nginx.config 中把user 后的 nginx 改为root
在etc/nginx/config.d/文件夹下创建文件web.conf , 写入
map $request_method $cors_method {
OPTIONS 11;
GET 1;
POST 1;
DELETE 1;
PUT 1;
default 0;
}
server {
listen 8070;
server_name _;
root /root/;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
if ($cors_method ~ '1') {
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' 'DNT,token,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($cors_method = '11') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
location /api {
proxy_set_header Host $host;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:8089/;
if ($cors_method ~ '1') {
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' 'DNT,token,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($cors_method = '11') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE';
add_header 'Content-Type' 'text/plain; charset=UTF-8';
add_header 'Access-Control-Allow-Headers' 'DNT,token,lang,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Content-Length' 0;
return 204;
}
}
location /ws {
proxy_pass http://127.0.0.1:8088/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
其中:
8070为VUE项目访问的端口,root 后 (此地为/root/)为dist文件夹目录,如果是连带dist文件夹copy过来,则改为/root/dist/
给dist文件夹777权限 chmod 777 dist/
启动nginx ( systemctl start nginx )
项目
wetech(github上搜索)
编译命令
mvn clean package
生成的jar包在target文件夹下,通过ftp工具放入 服务器 root用户下,java -jar xxx.jar 运行jar包,端口默认8000/8080,记得关闭防火墙/通过端口
(如果出现找不到manifast之类的错误,以及出现找不到springApplication 的错误,删除以下代码)
VUE编译命令
yarn/npm run serve (本地运行,访问localhost:8060即可访问)
yarn/npm run build (target文件夹生成dist文件夹,通过ftp放入root目录下)