当前位置: 首页 > news >正文

若依部署项目到服务器

目录

一、环境配置

redis

nginx(宿主机|dokcer)

1.宿主机

2.docker

二、打包jar包

0.查看后端配置

1.打包后端

2.打包前端

三、启动

1.后端

2.前端

 四、以上部署常见命令/错误


一、环境配置

之前的课都配过,先看看自己配了没

 看看启动了啥  docker ps

redis

见上  redis启用过了

nginx(宿主机|dokcer)

1.宿主机

强制启动,查看是否启动成功,没有就是端口占用,关了就行

 如果有以下,则证明是docker里边的,要么见2,要么停了dokcer再1

2.docker

docker run -d --name nginx\-p 80:80 \--restart=always \-v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \-v /opt/nginx/html/dist:/usr/share/nginx/html \nginx:1.25.0

二、打包jar包

0.查看后端配置

1.打包后端

打包之后的在这里👇

2.打包前端

三、启动

1.后端

 

切换到自己的jar包放置路径
java -jar ruoyi-admin.jar

 这样就启动成功后端了

 访问路径  公网地址:8080

2.前端

把打包好的dist复制到宿主机上,注意自己的路径

 更改这里边的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  82.157.170.39 localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   /opt/nginx/html/dist;try_files $uri $uri/ /index.html;index  index.html index.htm;}location /prod-api/ {proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://172.17.0.1: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   /opt/nginx/html/dist;}# 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;#    }#}}

 运行地址  公网地址  出来验证码就算对了

 四、以上部署常见命令/错误

#查看端口是否被占用
sudo netstat -tulnp | grep :80#查看进程是否启动
ps aux | grep nginx#进入容器内部
docker exec -it nginx /bin/bash#查看容器内nginx.conf文件内容
cat etc/nginx/nginx.conf#关于防火墙
systemctl start firewalld 开启防火墙systemctl restart firewalld 重启防火墙systemctl status firewalld 查看防火墙状态systemctl disable firewalld 开机自动不启动防火墙firewall-cmd --permanent --add-port=端口/tcp 设置防火墙放
行端口,此操作需要重启防火墙生效# 重新加载防火墙规则
firewall-cmd --reload# 详细查看放行端口
firewall-cmd --list-all

后端没什么大问题,主要是前端

如果有404 500  页面无法访问错误,就是nginx.conf配置有错,或者nginx启动有错

http://www.dtcms.com/a/287937.html

相关文章:

  • 数字图像处理(三:图像如果当作矩阵,那加减乘除处理了矩阵,那图像咋变):从LED冬奥会、奥运会及春晚等等大屏,到手机小屏,快来挖一挖里面都有什么
  • Springboot项目的搭建方式5种
  • 深入解析 Amazon Q:AWS 推出的企业级生成式 AI 助手
  • 默认显示两行文字,多余的文字省略掉,变成省略号
  • Vue状态管理:Vuex模块设计方案
  • SpringBoot服装推荐系统实战
  • C++string类(2)
  • fclose 函数的概念和使用案例
  • GEE:批量处理和下载SoilGrids 250m v2.0
  • 区块链可投会议CCF A--ICDE 2026 截止10.27 附录用率
  • 【科研绘图系列】R语言绘制显著性标记的热图
  • 数学建模:运筹优化类问题
  • 3.5软件开发活动[2-系统设计]面向对象设计-UML统一开发过程
  • 短视频矩阵的未来前景:机遇无限,挑战并存
  • Tomcat 生产 40 条军规:容量规划、调优、故障演练与安全加固
  • Linux Ubuntu安装教程|附安装文件➕安装教程
  • 尚庭公寓-----day2 业务功能实现
  • PHP 就业核心技能速查手册
  • Delphi XE 自带了 Base64编码解码
  • 前端知识回顾-登录界面
  • 从“数字土著”到“数据公民”:K-12数据伦理课程的设计、实施与成效追踪研究
  • 开启你的专属智能时代:枫清科技个人智能体限时体验计划上线!
  • 简单易懂,段页式管理
  • 【leetcode100】寻找重复数
  • Codeforces Round 1037 (Div. 3)(补题)
  • 数据结构与算法之美:拓扑排序
  • Kimi K2 日调用量超100亿 token,API 价格低于 Claude 系列模型
  • 正则表达式概述
  • 垃圾回收(GC)
  • 机器学习漫画小抄 - 彩图版