程序员开发实例大全宝库

网站首页 > 编程文章 正文

基于vue nuxt.js element-ui的开源博客系统,页面由服务器端渲染

zazugpt 2024-08-27 23:46:53 编程文章 36 ℃ 0 评论

来源:https://github.com/beijing-xiaotinghua/layBlog-ui

安装

 git clone https://github.com/beijing-xiaotinghua/layBlog-ui.git 

安装包依赖

 npm install

使用cnpm安装包依赖更快,首先安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install

运行

运行发开环境

npm run dev

本地访问http://localhost:3000

打包部署,打包部署必须在服务器端

首先打包编译项目

npm run build

运行项目

npm run start

建议使用pm2管理npm进程

安装pm2

cnpm install -g pm2

pm2运行项目

执行时确保已经在项目根目录

pm2 start ./node_modules/nuxt/bin/nuxt -- start

pm2查看项目列表

pm2 list

pm2关闭项目

pm2 stop id

pm2启动项目

pm2 start id

在真实的服务器环境中运行项目

配置nginx反向代理

server {
 listen 80;
	server_name your domain;
 root /var/www/html/layadmin-blog-ui;
 index index.php index.html index.htm;
 location / {
	 proxy_pass http://127.0.0.1:3000;
 }
}

以上只是能够确保运行的简洁配置,生产环境中根据需要自行增加配置

功能说明

  • 使用nuxt.js做服务端渲染ssr.
  • 使用element-ui 组件库.
  • 使用axios网络请求库
  • 使用了layui前端css样式
  • 使用了短信验证码登陆、注册
  • 实现了评论、点赞功能

线上服务预览:https://bw31d.com/

本地后端接口配置

修改nuxt.config.js文件, 根据需要修改你的接口地址

proxy: [
 ['/api', { target: 'http://api.bw31d.com' }]
]

修改plugins/axios.js文件

if (process.server) {
 options.baseURL = 'http://api.bw31d.com'
}

后台管理系统截图

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表