在cPanel上部署Angular webApp [英] Deploy Angular webApp on cPanel

查看:90
本文介绍了在cPanel上部署Angular webApp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在cPanel上部署我的angular 6应用程序. 有人可以指导我执行这些步骤吗?

I need to deploy my angular 6 app on cPanel. Can someone guide me the steps?

我在cPanel中找不到配置文件夹.

I cant't find configuration folder in cPanel.

推荐答案

STEPS

使用以下命令创建生产版本.

Create a production build by using following command.

ng构建--prod

您将获得很少的生产错误,除非您不解决它们,否则将无法创建生产版本.

You will get few production errors, unless you don't fix them you won't be able to create production build.

您将在根目录的项目文件夹中找到新文件夹 dist .打开该文件夹,有一个包含基本href(href ="/")的 index.html 文件.将"/"替换为您要上传dist的合适路径.

You will find new folder dist in project folder at root. Open that folder, there is index.html file containing base href (href="/"). Replace "/" with the suitable path where you want to upload dist.

打开FileZilla,使用适当的凭据与服务器连接.打开要在远程服务器上上传dist的文件夹.将内容上载到远程服务器位置上的dist文件夹中.请不要忘记更改基本href ,否则默认情况下它将采用root路径.

Open FileZilla, connect with server by using proper credentials. Open folder where you want to upload the dist on remote server. Upload the contents in dist folder on remote server location. Please don't forget to change the base href, otherwise it will take the path from root by default.

重要的部分是添加.htaccess" 文件,除非您不添加它,否则将无法从主页路由到其他地方.将显示找不到文件错误.

Important part is to add the ".htaccess" file, unless you don't add it, you won't be able to route from home page to somewhere else. File not found error will be displayed.

如何创建.htaccess文件?

How to create a .htaccess file ??

.htaccess文件完全取决于要使用的服务器... 每种服务器都有不同的服务器配置,例如Apache,NGinx,IIS等

.htaccess file is totally depends on which server you are going to use... There is different server configuration for each one like Apache, NGinx, IIS, etc

有关更多详细信息,请参阅以下有关Angular应用程序部署的文档.

For more details please refer following documentation of Angular app deployment.

Angular应用程序部署文档

这篇关于在cPanel上部署Angular webApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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