当前位置: 首页> 汽车> 时评 > 建站63年来第一次闭站 北京站辟谣_房屋信息网站_地推公司_课程培训

建站63年来第一次闭站 北京站辟谣_房屋信息网站_地推公司_课程培训

时间:2025/7/12 7:08:54来源:https://blog.csdn.net/u010843503/article/details/146605672 浏览次数: 0次
建站63年来第一次闭站 北京站辟谣_房屋信息网站_地推公司_课程培训
@pinia-plugin-persistedstate/nuxt": "^1.2.1","@pinia/nuxt": "^0.10.1","@types/node": "^22.13.14","pinia": "^3.0.1","sass": "^1.86.0",

nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({ssr:true, //仅在客户端渲染, 就和纯vue项目一样compatibilityDate: "2024-11-01",devtools: { enabled: true },routeRules:{// 首页在构建时预渲染'/': { prerender: true },// 产品页面按需生成,在后台重新验证,缓存直到 API 响应变化'/home': { swr: true },},modules: ['@pinia/nuxt',
"@pinia-plugin-persistedstate/nuxt",],runtimeConfig: {apiSecret: "123",// Keys within public are also exposed client-sidepublic: {apiBase: "/api",apiSecret: "123",},soert:{nameL:"测试"},// server: {//   host: 'localhost'// },},build: {// 持久化插件配置 必需transpile: ["pinia-plugin-persistedstate/nuxt"],},// pinia: {//   autoImports: ["defineStore"], // 自动引入 defineStore// },// 这里也可以通过vite全局引入vite: {css: {preprocessorOptions: {scss: {additionalData: `@use "@/assets/css/index.scss" as *;`}}}}// css:[//   '@/assets/css/index.css'// ]
});

tsconfig.json

{"compilerOptions": {"allowImportingTsExtensions": true, // 关闭选项"types": ["node", "pinia-plugin-persistedstate"]},// https://nuxt.com/docs/guide/concepts/typescript"extends": "./.nuxt/tsconfig.json"
}

部署服务器

pnpm run build 打包

在output文件里新建ecosystem.config.js文件,配置如下

module.exports = {apps: [{name: 'gbh',script: './server/index.mjs',env:{NODE_ENV:'production',PORT:'9089'//端口 访问:http://localhost:9089/}}]}

将.output文件下的四个文件拷贝到nginx服务器文件夹下

在这里插入图片描述

linux安装配置node

官网 https://nodejs.org/en/download

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"
# Download and install Node.js:
nvm install 23
# Verify the Node.js version:
node -v # Should print "v23.10.0".
nvm current # Should print "v23.10.0".
# Verify npm version:
npm -v # Should print "10.9.2".

按上方命令执行
npm i pm2 -g 安装pm2进程守护

在nginx服务器文件夹地址栏输入cmd 弹出小黑窗,输入pm2 start ecosystem.config.js 启动服务

在这里插入图片描述

修改nginx的代理端口为9089

关键字:建站63年来第一次闭站 北京站辟谣_房屋信息网站_地推公司_课程培训

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: