How to deploy a nextjs application on cpanel?

坚强是说给别人听的谎言 提交于 2020-02-05 05:40:27

问题


I followed these steps to deploy my nextjs on cPanel.

  1. go to package.json and add this line: "homepage": "http://afsanefadaei.ir"

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

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

  4. 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:


  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.

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



来源:https://stackoverflow.com/questions/60008008/how-to-deploy-a-nextjs-application-on-cpanel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!