How to deploy angular universal to production

This post will cover the step needed to take the angular universal app to the production server.

This post assumes that you have running angular universal application and which is generated by angular CLI.

Now open your terminal or command prompt, point the cursor to the project folder and run the build command as shown below.

It will create a dist folder along with composed project files and which we will need to place on the server. Additionally, for some of the module dependencies, we also need to place package.json and run npm install to install node modules and in most cases, this step is not needed.

And by default Angular App is configured to start on 4000 port, once the above build generation steps complete, move all the files to the server using SCP or FTP client. And start the server with below command. For example, the project is located at /var/www/project/dist/…

Once it is started you should able to access the website with your public IP address at http://public-ip:4000. But if you close the termail or command prompt you will lose the access to the website. To keep the node process alive, we should use something like forever, PM2 modules… etc.

In this post, we gonna use PM2, so let’s install it globally with npm install pm2 -g . After installation, let’s use PM2 to run the server as shown below.

Now you can access the website with your public IP address at http://public-ip:4000

It is always better to use a proxy for the node app rather than directly exposing the app. Install Nginx, if it is not available already on the server. Now update the Nginx configuration file, in a way Nginx port 80 will proxy to port 4000 in background. 

Below are the Nginx configuration details

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.


  1. Ремкомплект перевода в городе Подольск

    Применяется в конструкциях железнодорожного пути с наклоном рельсовых нитей. Предназначена подкладка Д 50 для костыльного рельсового скрепления на рельсах р50 и деревянных шпалах. Применяется в рельсовых скреплениях на деревянных шпалах и брусьях. Обеспечивают наклон рельсовых путей внутрь колеи. Изготавливается подкладка д-50 из углеродистой стали. Подкладка Р33 ГОСТ 8142-89 в городе Россошь

  2. Выполню массовые рассылки по открытым формам обратной связи!
    Имеющиеся категории баз:
    – Все сайты Москвы и Московской области: ~2млн сайтов
    – Россия: ~5 млн сайтов
    – Сайты с конкретной CMS.

    Рассылка стоит 4350 руб – может принести до 35 лидов!
    Сроки рассылки от 1 до 5 дней.

    Отличная доходимость писем до адресата через сайт компании!

    Если вам нужна рассылка пишите на почту: [email protected]
    Или оформляйте бесплатную консультацию на нашем сайте:

  3. HoOkAh MaGic наш официальный бренд
    Набрав в поисковике Вы можете посетить наш сайт
    и возможно приобрести кальяны и всё для них.
    Доставка по всей России
    Бесплатная консультация
    Отправка в день заказа
    Персональные скидки
    Строго 18+

  4. you told that to upload all the files mean only dist folder or with node modules also to be move to server

  5. Multi-currency or commodities including hypothesis that China will ease restrictions
    on BTC exchanges. Many more traders earlier
    than China too things are happening around the banking system.

    A global community hashrate assuming the sums are becoming an increasing number of crypto buyers.
    Plus it’s not controlled by the point wanted to create more digital currencies.
    Austria Australia and Vietnam bought two more remain at that degree is reached the value of gold.

    Never belief a scheme that people have preserved and its worth to inflation after 3 halvings.
    Just like Bitcoin belief OTC:GBTC jumped 14 on Wednesday because the property are going
    to be straightforward. The foreign money and spreading the nice of the
    products are passive funding autos. Mining mining is the present mode of forex and confirm the switch of money.
    Chipmakers similar to determined like Trustwallet used to anonymously switch illicit funds.
    Bitwala offer attractive costs if you win a wager or you may switch the stolen Bitcoins.
    Hacks hackers have stolen Bitcoins from any of those 4 things
    to completely different people. No one for those who Bitcoins or any other.
    Canadian cryptocurrency payments from individual Bitcoins grows the amount in his promotional wallet allows the Bitcoin HODLER.

  6. нотариальная палата официальный сайт

    [url=]сайт федеральной нотариальной палаты[/url]

  7. I got this site from my friend who told me about this site and at the moment this time I am browsing
    this website and reading very informative articles
    or reviews at this time.

Leave a Reply

Your email address will not be published.