Deploy Angular webApp on cPanel

a 夏天 提交于 2020-01-04 04:27:04

问题


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

I cant't find configuration folder in cPanel.


回答1:


STEPS

Create a production build by using following command.

ng build --prod

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

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.

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.

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.

How to create a .htaccess file ??

.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

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

Angular app deployment documentation



来源:https://stackoverflow.com/questions/52128439/deploy-angular-webapp-on-cpanel

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