如何在cpanel上部署nextjs应用程序? [英] How to deploy a nextjs application on cpanel?

查看:94
本文介绍了如何在cpanel上部署nextjs应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照以下步骤在cPanel上部署了nextjs.

I followed these steps to deploy my nextjs on cPanel.

  1. 转到package.json并添加以下行:"homepage": "http://afsanefadaei.ir"

运行next build.next文件夹作为我的构建文件夹

run next build to have .next folder as my build folder

转到cpanel >> file manager >> public_html文件夹并将.next文件夹的内容上传到此目录

go to cpanel >> file manager >> public_html folder and upload the contetn of .next folder to this directory

添加或编辑以下文件:.htaccess至:

add or edit this file: .htaccess to:

但是当我访问该网站时,我会面对:

but when I go to the website I face this:

你知道这是怎么回事吗?

Do you know what is wrong with this?

推荐答案

  1. 您的.next没有index.html文件.
  2. 似乎您拥有服务器端(主要使用nodejs),但不幸的是,您无法从cpanel运行该服务器端.
  3. 据我所知,如果您倾向于只使用前端,则应该使用next export而不是next build.
  1. Your .next doesn't have index.html file.
  2. Seems like you have server side (mostly using nodejs), but unfortunately you couldn't run that server side from cpanel.
  3. As I know, you should use next export instead of next build if you tend to have frontend side only.

但是最重要的是数字1,请确保.next文件夹中有index.html.

But the most important thing is number 1, make sure you have index.html inside your .next folder.

这篇关于如何在cpanel上部署nextjs应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆