发布于2024-11-02 12:43 阅读(1013) 评论(0) 点赞(4) 收藏(4)
打包后端‘
1,打开若依,点击右侧的Maven展开Maven管理,选择ruoyi>Lifecycle 先双击clean清除原本启动项目时生成的文件。然后点击package等待项目打包,切记要取消运行再打包
打包完成后会在ruoyi-admin>src>target里面看到.jar后缀的文件,就代表打包成功(可以把这个文件复制出来存放到其他地方,方便后面启动)
2,这个就是打包出来的文件
假如没成功,可以试试点这两个再清除一下
3,新建一个文件夹,把这个包丢进去
打开cmd
java -jar ruoyi-admin.jar
要保证端口没有被占用
前端使用
npm run build:prod
打包出来的文件
nginx
1,
2,把前端的dist打包文件放进去
3,运行(1)
4,启动(2)
- 启动
-
- start nginx
-
- 重新启动
-
- nginx -s reload
-
- 关闭nginx
-
- nginx -s stop
-
-
- 强制关闭
-
- taskkill taskkill /f /t /im nginx.exe
nginx配置
- listen 填前端要运行的端口, 你想用什么端口就用什么端口,不一定和开发时候的端口一样
-
- listen 8085;
-
- tip:nginx配置好,前端访问就要用配置好的这个端口访问
- 这里要填你后端的端口
- proxy_pass http://127.0.0.1:8025/;
nginx访问页面
ip+ nginx配置的前端端口
-
- #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 8085;
- server_name localhost;
- root html//dist;
- # root C://nginx//nginx-1.26.1//html//dist;
- #charset koi8-r;
-
- #access_log logs/host.access.log main;
-
- location /{
- try_files $uri $uri/ /index.html;
- index index.html index.htm;
- autoindex on;
- }
-
- 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://127.0.0.1:8025/;
- }
-
- #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;
- # }
- #}
-
- }
原文链接:https://blog.csdn.net/m0_61265297/article/details/142172879
作者:再拍我就焖面
链接:http://www.phpheidong.com/blog/article/554279/f8b342cf130ffab7b060/
来源:php黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 php黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-4
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!