skip to Main Content

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

I cant’t find configuration folder in cPanel.

2

Answers


  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

    Login or Signup to reply.
  2. Step 1: Run "ng build –watch"

    Step 2: Upload the files in a "dist" folder to your hosting environment.

    Step 3: Update the index.html to,

        <base href="/"> **to** <base href="/projectDeployPath/">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search