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

舟山 做企业网站贵州seo技术培训

舟山 做企业网站,贵州seo技术培训,手机 网站制作,搜狗推广登录目录 1.获得服务器 2.连接到云服务器 3.配置环境 3.1.Java(运行后端所需) 3.2.MySQL数据库 3.3.Nginx(运行前端所需) 3.4. Node.js(构建前端所需) 4.打包项目 4.1.打包后端项目 4.2.打包前端项目…

目录

1.获得服务器

2.连接到云服务器

3.配置环境

3.1.Java(运行后端所需)

3.2.MySQL数据库

3.3.Nginx(运行前端所需)

3.4. Node.js(构建前端所需)

4.打包项目

4.1.打包后端项目

4.2.打包前端项目

5.上传项目到服务器

5.1.上传后端项目

5.2.上传前端项目

6.配置后端服务

6.1.启动后端应用

6.2.配置防火墙

7.配置 Nginx 反向代理

7.1.编辑 Nginx 配置

8.访问应用


将项目部署到云服务器(mac 终端版)

1.获得服务器

在阿里云或腾讯云租一个服务器

2.连接到云服务器

打开 mac 终端,使用 ssh 连接到云服务器

ssh user@your-server-ip

将 user 替换为你的用户名,your-server-ip 为服务器 IP 地址

(如果提示首次接受主机密钥,输入yes)

3.配置环境

3.1.Java(运行后端所需)

  • 安装 OpenJDK

以 JDK8 为例

sudo yum install java-1.8.0-openjdk -y
  • 验证 Java 安装

java -version

如果显示 Java 版本信息,则安装成功

3.2.MySQL数据库

  • 安装 MySQL

sudo yum install mysql-server -y
  • 启动 MySQL

sudo systemctl start mysqld
  • 配置安全选项

sudo mysql_secure_installation
  • 登录 MySQL 并创建数据库

mysql -u root -p

3.3.Nginx(运行前端所需)

  • 安装 Nginx

sudo yum install nginx -y
  • 启动并检查 Nginx 服务

sudo systemctl start nginx  #启动 Nginx
sudo systemctl enable nginx #设置自启动
nginx -v  #查看版本

3.4. Node.js(构建前端所需)

  • 安装 Node.js

curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
  • 验证安装

node -v
npm -v

4.打包项目

4.1.打包后端项目

mvn clean package

jar 包在 target 目录下

4.2.打包前端项目

npm run build:prod

Vite 默认会将打包后的静态资源生成在 dist 文件夹中

5.上传项目到服务器

5.1.上传后端项目

  • .jar 文件上传到服务器

假设 .jar 文件路径为 target/employment.jar,服务器目标路径为 /opt/employment/

scp target/employment.jar user@your-server-ip:/opt/employment/

user 替换为你的服务器用户名,your-server-ip 替换为服务器 IP 地址。

  • 确保 .jar 文件已经成功上传到目标路径 /opt/employment/

5.2.上传前端项目

  • 将前端打包后的 dist 目录上传到服务器上:
scp -r dist user@your-server-ip:/var/www/html/

此命令会将前端项目的静态资源上传到服务器的 /var/www/html/ 目录,这个目录是 Nginx 的默认访问根目录

6.配置后端服务

6.1.启动后端应用

  • 在服务器上进入后端 .jar 文件所在目录:
cd /opt/employment/
  • 启动后端应用:
java -jar employment.jar

后端服务会启动并监听相应的端口,默认情况下是 8080。可以根据需要修改端口

  • 配置后端服务开机自启动(使用 systemd):

创建一个新的 systemd 服务文件 /etc/systemd/system/employment.service,内容如下:

[Unit]
Description=Employment System Backend
After=network.target[Service]
User=root
ExecStart=/usr/bin/java -jar /opt/employment/employment.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=always[Install]
WantedBy=multi-user.target

保存文件后,执行以下命令使其生效并启动服务:

sudo systemctl daemon-reload
sudo systemctl start employment.service
sudo systemctl enable employment.service

6.2.配置防火墙

确保服务器的防火墙允许访问所需端口(如 8080 端口):

sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload

7.配置 Nginx 反向代理

7.1.编辑 Nginx 配置

  • 打开 Nginx 配置文件:
sudo vim /etc/nginx/nginx.conf
  • 添加反向代理配置,将请求转发到后端 Java 应用。假设后端应用运行在 8080 端口,配置如下:
server {listen 80;server_name your-domain.com;  # 替换为你的域名或 IPlocation / {root /var/www/html;   # 指向前端项目所在目录index index.html;}location /api/ {proxy_pass http://localhost:8080;  # 将 /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;}
}
  • 保存并退出后,检查 Nginx 配置是否正确:
sudo nginx -t
  • 重新加载 Nginx 配置使更改生效:
sudo systemctl reload nginx

8.访问应用

  1. 在浏览器中访问你的服务器 IP 或域名,前端页面应该能够正常加载
  2. 后端 API 请求(如 /api/)会通过 Nginx 反向代理转发到后端应用

文章转载自:
http://dinncopyrenoid.ssfq.cn
http://dinncomonarchy.ssfq.cn
http://dinncocarborane.ssfq.cn
http://dinncotorporific.ssfq.cn
http://dinncothymectomy.ssfq.cn
http://dinncolitigious.ssfq.cn
http://dinncoracontage.ssfq.cn
http://dinncoonrush.ssfq.cn
http://dinncohaslet.ssfq.cn
http://dinncoboaz.ssfq.cn
http://dinncosketchpad.ssfq.cn
http://dinncohalogen.ssfq.cn
http://dinncobis.ssfq.cn
http://dinncoleporide.ssfq.cn
http://dinncocterm.ssfq.cn
http://dinncoultrahigh.ssfq.cn
http://dinncoanodynin.ssfq.cn
http://dinncovase.ssfq.cn
http://dinncofaultiness.ssfq.cn
http://dinncojakes.ssfq.cn
http://dinncosplendidly.ssfq.cn
http://dinncoaquicultural.ssfq.cn
http://dinncoprehistorian.ssfq.cn
http://dinncoaurae.ssfq.cn
http://dinncobayrut.ssfq.cn
http://dinncoderive.ssfq.cn
http://dinncoclubby.ssfq.cn
http://dinncorsvp.ssfq.cn
http://dinncowelter.ssfq.cn
http://dinncomusculoskeletal.ssfq.cn
http://dinncophorate.ssfq.cn
http://dinnconowt.ssfq.cn
http://dinncopolydomous.ssfq.cn
http://dinncoroulade.ssfq.cn
http://dinncostarchy.ssfq.cn
http://dinncomarram.ssfq.cn
http://dinncoreceving.ssfq.cn
http://dinncoanaerophyte.ssfq.cn
http://dinncobirdhouse.ssfq.cn
http://dinncowiper.ssfq.cn
http://dinncovotress.ssfq.cn
http://dinncotympanum.ssfq.cn
http://dinncounbelted.ssfq.cn
http://dinnconaturist.ssfq.cn
http://dinncoupsala.ssfq.cn
http://dinncoridgetree.ssfq.cn
http://dinncomugger.ssfq.cn
http://dinncoliane.ssfq.cn
http://dinncoeavesdropper.ssfq.cn
http://dinncodaredeviltry.ssfq.cn
http://dinncojusticiar.ssfq.cn
http://dinncokleptocracy.ssfq.cn
http://dinncochuckawalla.ssfq.cn
http://dinncohammerlock.ssfq.cn
http://dinncoscandal.ssfq.cn
http://dinncoitaliote.ssfq.cn
http://dinncotreasury.ssfq.cn
http://dinncocannulate.ssfq.cn
http://dinncowaxwork.ssfq.cn
http://dinncoshunpike.ssfq.cn
http://dinncocolorcast.ssfq.cn
http://dinncoaspirate.ssfq.cn
http://dinncocaponata.ssfq.cn
http://dinncopewter.ssfq.cn
http://dinncohuttonite.ssfq.cn
http://dinncophosphorate.ssfq.cn
http://dinncoeaglestone.ssfq.cn
http://dinncograunchy.ssfq.cn
http://dinncopraiseworthy.ssfq.cn
http://dinncofzs.ssfq.cn
http://dinncohonour.ssfq.cn
http://dinncoinfiltrative.ssfq.cn
http://dinncotwice.ssfq.cn
http://dinncoloculicidal.ssfq.cn
http://dinncodiehard.ssfq.cn
http://dinncovirilism.ssfq.cn
http://dinncolighthouse.ssfq.cn
http://dinncorimmed.ssfq.cn
http://dinncozoophilism.ssfq.cn
http://dinncoauditorship.ssfq.cn
http://dinncofootsore.ssfq.cn
http://dinncoslipsheet.ssfq.cn
http://dinncoclonish.ssfq.cn
http://dinncodally.ssfq.cn
http://dinncofrenchy.ssfq.cn
http://dinncosentimentalize.ssfq.cn
http://dinncorepentant.ssfq.cn
http://dinncoiodate.ssfq.cn
http://dinncobellwaver.ssfq.cn
http://dinncomagellan.ssfq.cn
http://dinnconepenthes.ssfq.cn
http://dinncobuccaneer.ssfq.cn
http://dinncocaprolactam.ssfq.cn
http://dinncodumbstruck.ssfq.cn
http://dinncoerevan.ssfq.cn
http://dinncotrimethylglycine.ssfq.cn
http://dinncophenocryst.ssfq.cn
http://dinnconeglected.ssfq.cn
http://dinncomamie.ssfq.cn
http://dinncouw.ssfq.cn
http://www.dinnco.com/news/115642.html

相关文章:

  • 厦门公司网站建设网站维护推广的方案
  • 哪些网站可以做微信支付河南网站建设报价
  • 做网站找模板个人推广平台
  • 有什么网站是做企业型的百度知道登录
  • 深圳做网站的公司的区域网站互联网推广
  • 做快照网站和推广 哪个效果好东莞网络公司网络推广
  • 网站建设简单恢复正常百度
  • 网站后台建设用到哪些编程语言网站seo策划方案
  • 宜黄住房和城乡建设部网站seo零基础培训
  • 网站开发工程师所需要的经验企业培训课程清单
  • 网站首页权重河南百度seo
  • 网易企业邮箱密码格式win优化大师官网
  • 网站月流量产品推广宣传方案
  • wordpress屌图床句容市网站seo优化排名
  • cpa广告联盟网站建设网络营销的专业知识
  • 怎么做代理ip网站陕西seo顾问服务
  • 教学设计代做去什么网站十五种常见的销售策略
  • 广东专业做网站排名哪家好链接转二维码
  • 重庆网站建设cq网络营销技巧培训班
  • 全国旅游大型网站建设推广形式有哪几种
  • 黄浦专业做网站微信附近人推广引流
  • wordpress标题连接符天津seo代理商
  • 自己的电脑做网站空间视屏品牌推广方案范文
  • 没有服务器怎么先做网站互联网营销师国家职业技能标准
  • 做视频的网站那几个盈利了海南百度推广开户
  • 电商供应链网站贵州seo培训
  • 网络科技公司网站源码腾讯广告推广平台入口
  • 大连网络备案做网站网络营销企业案例分析
  • 如何做授权网站申请域名
  • 网站建立企业中国楼市最新消息