skip to Main Content

I have Apache Web Server running on EC2 (RHEL 7) on port 80.

Also have Angular App running on port 4200 on the same server.

How to bind port 80 so that when someone from outside goes to IP (e.g. 1.2.3.4) goes directly to Apache port 80 (that part works now) which then redirect (or bind) to port 4200 so that the end user can see Angular app output (instead of Apache output)?

Thanks.

2

Answers


  1. Use a reverse proxy Nginx for example.
    The step will be the following: Nginx listens 80 port from outside and passes this request to 4200 to your Angular app.
    Why do you use apache on this port? And what does apache do?

    Login or Signup to reply.
  2. You should instead like Red Cricket says follow the docs.

    First run ng build prod or whatever build you need.

    Then add the .htaccess file with redirect rules into your dist folder and place it wherever your apache will serve the angular app.

    For extra details see the link provided by Red Cricket.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search