1)控制台运行
java -jar test.jar
2)控制台添加本地配置运行
java -jar test.jar --spring.profiles.active=dev --server.port=8888 --spring.config.loaction=./application.properties
** 运行项目中已有 server.port 指定端口,这里就不用再写
3)后台运行
nohup java -jar test.jar --spring.profiles.active=dev > log.out 2>&1 &
** --spring.profiles.active=dev 配置开发、生产环境,若没有就不用配置
nginx,页面用vue
listen 80;
server_name www.test.cc;
root G:\dist;
index login.html index.html index.htm;
location / {
try_files $uri $uri/ @router;
index index.html index.htm;
}
location ^~ /api/ {
proxy_redirect off;
proxy_cache off;
proxy_read_timeout 600;
proxy_pass http://127.0.0.1:8888/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $remote_addr;
}
location @router {
rewrite ^.*$ /index.html last;
}