This is a Next.js project bootstrapped with create-next-app.
npx --yes create-next-app"@latest" . --ts
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev# 全局安装 PM2(进程管理器,保证服务常驻)
npm install -g pm2
# 启动 Next.js 应用
pm2 start npm --name "website" -- run start
# 查看运行状态
pm2 list
pm2 logs website
# 更新代码后重新部署
git pull
npm install
npm run build
pm2 restart website
# 开机自启 PM2
pm2 startup
pm2 saveserver {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
| 前缀 | 屏幕尺寸 |
|---|---|
sm: |
≥640px |
md: |
≥768px |
lg: |
≥1024px |
xl: |
≥1280px |
2xl: |
≥1536px |