dubwis3
dubwis3

Reputation: 11

How to deploy Angular App in Live Server (Digital Ocean)?

I've uploaded my app in Digital Ocean server but it seems it's not working properly, here's the link of my app http://138.68.21.3/pos/. Once you've entered in this address and when you refresh the page it says "Not Found" and "The requested URL /pos/login was not found on this server."

I don't know if my steps in deploying the angular app in live server are correct:

Step 1: I've typed ng build --prod

Step 2: Copied the files in dist folder and paste it in to root directory

Anyone who is expert in deploying angular app in live server? I need your help guys :(

Upvotes: 1

Views: 3048

Answers (1)

Chintan Joshi
Chintan Joshi

Reputation: 1307

For that you need to use useHash in AppRoutingModule like this.

@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})

And also add

<base href="./"> instead <base href="/"> inside index.html

Hope this helps.

Ask me if any query.

Upvotes: 1

Related Questions