Gopalakrishnan
Gopalakrishnan

Reputation: 957

How to access angular 6 application from other machine?

I installed Angular 6, that runs in my local machine. But not run another machine which is connected local network. I have tried these steps but not use.

ng serve --host 10.0.136.126 // http://10.0.136.126:4200
ng serve --host 0.0.0.0 // http://10.0.136.126:4200
ng serve --host=0.0.0.0 // http://10.0.136.126:4200
ng serve --host=0.0.0.0 --disable-host-check // http://10.0.136.126:4200
ng serve --host 10.0.136.126 --disable-host-check // http://10.0.136.126:4200

Above command is working fine in my machine but not in my colleague machine which is connected local network. I'm using ubuntu 16.04, tested with both ubuntu and windows machine. Versions:

Angular CLI: 6.0.8
Node: 8.11.3
OS: linux x64
Angular: 6.0.4

node --version => 6.1.0
npm --version => 8.11.3

But I can access my phpmyadmin or any php project with http://10.0.136.126/phpmyadmin in other machine.

Upvotes: 0

Views: 1807

Answers (2)

Gopalakrishnan
Gopalakrishnan

Reputation: 957

Yes the culprit is firewall with port number in ubuntu 16.04 machine. Have to check the firewall. And add port number by

sudo ufw allow 4200/tcp

Upvotes: 2

bereket gebredingle
bereket gebredingle

Reputation: 12996

If your are accessing your php-projects and phpMyAdmin this means there is already a server running.

So in order to use your angular project you can easily deploy on the server.

  1. run ng build --base-herf . // dont forget the dot
  2. copy the dist folder to the server's www folder.

    • if you are using apache copy the dist folder and past it in the /var/www/html

Then you can access your angular project http://10.0.136.126/dist

Let me know if this helps or not.

Upvotes: 0

Related Questions