1

I am working on angular application and I have enabled angular universal into it. On local it is working perfectly. I am able to see all parent and child components getting rendered properly. and Meta tags and Title is also updating in Page source view and inspect element.

I created a build using "npm run build" command. Please find package.json Please find package.json scripts here

and run using "npm run start" command. on local this build is working as expected.

Then I moved this files to ubuntu server at "var/www/html" directory. final folder structure looks like this

Then I updated sites_available and sites_enable file. config file looks like this

I was at html directory and run command "pm2 start dist/server/main.js". restarted and reloaded nginnx server.

results were, my home page is getting rendered properly. but child pages i.e.(/child pages) this are not getting rendered at all.

Any one know what went wrong in this? please help or guide to resolve this.

All tried steps mentioned in question details. Expectations are this application should work similar way as it is working on local.

  • Can you remove the `try_files` line from the location block? If you want to `proxy_pass` your request to the port `4000`, you can't use `try_files` beforehand. – Geilmaker Jul 22 '23 at 19:08
  • I was able to figure out this. now it is working. @Geilmaker yes try_files was one of the reason. we dont need this here. then my folder path was also incorrect and because of that home page was getting rendered but child pages were running completely at client side. checkout: https://toolsguruhub.com just trying to do something. – PRATHMESH CHOPADE Jul 23 '23 at 06:12
  • Looking good! Glad to hear you could fix it :) – Geilmaker Jul 23 '23 at 10:01

0 Answers0