打包文件部署 - shirleydl/MTest GitHub Wiki

  1. 部署mtest.jar(后端):运行命令如: nohup java -jar mtest.jar --server.port=8084 &

数据库连接默认账号:root,默认密码:password,默认端口8084;如需更改配置,可打开jar包里面application.yml进行修改

  1. 部署mtest_front(前端):解压mtest_front.zip,把mtest文件夹放到服务器指定文件路径,如nginx部署前端项目,修改nginx.conf配置(nginx.conf配置参考),重启配置生效,解压mtest_front.zip,把里面mtest文件夹放到nginx安装目录下的html文件夹里,重启配置生效命令如: nginx -s reload

默认后端请求为本地端口8084,如需更改后端域名,可下载源码修改src/utils/request.js的baseUrl,并重新打包部署

链接: https://pan.baidu.com/s/1yLKSIaaSx3G_UCLeQIUuXA 密码: g3f4

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       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root html;

        location /{
            try_files $uri $uri/ @router;
            index  index.html index.htm;
        }

        location /mtest{
            alias html/mtest;
            try_files $uri $uri/ /mtest/index.html;
            index  index.html index.htm;
        }

        location @router {
            rewrite ^.*$ /index.html last;
        }


        #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;
    #    }
    #}
}