-1

I have an application deployed on AWS, and an URL redirects to this application.

If I want users to use different URL to access different pages, how to do it?

For example, user A can access homepage 1 from homepage1.domain.com, user B can access homepage 2 from homepage2.domain.com.

Is this possible to achieve using same application instance?

Thanks.

Cosaic
  • 111
  • 2

1 Answers1

-1

Long story short yes, this is achievable. You need to use a web server that supports virtual hosting.

Following are few:

Use Nginx if you've very advance knowledge about web servers and able to configure them through the command line, even I struggle to get Nginx to work the first time as its design to as enterprise multipurpose server (web server, reverse proxy and many more).

You might find Apache or WampServer much more user-friendly than Nginx.

Prav
  • 129
  • 6
  • 1
    You're the first person I've seen to have a tougher time with nginx than Apache... I'd recommend nginx to anyone getting started, personally. – ceejayoz Jun 21 '18 at 00:59
  • Personally, I prefer Nginx hense its the first on the list but it's not the easiest one to configure, especially if you're noob to web servers and command line. That's why I didn't recommend it. – Prav Jun 21 '18 at 01:38
  • I'm using AWS which I think is nginx. I see that I need to set different virtual hosts to different html pages, but I have only one html file in the `dist` folder, what should I do? – Cosaic Jun 21 '18 at 13:14
  • @Cosaic "AWS" can encompass a lot of things, and both nginx and Apache are available on pretty much any of AWS's Linux AMIs. (IIS is available if you're using Windows, too.) You'd need to tell us what AMI you're using. You can also try poking around in `/etc` for folders like `apache2` or `httpd` (Apache) or `nginx` (what it says on the tin...) – ceejayoz Jun 21 '18 at 13:43
  • @ceejayoz I use elastic beanstalk to deploy my angular application, which is a dist folder copied to nginx html folder. There is only one index.html file inside, others are all resource files. – Cosaic Jun 21 '18 at 13:57
  • 1
    @Cosaic Unfortunately, Angular is designed to be served as a single page website, so according to this logic, it can't be served the way you want it. In practice it can be achieved, you need to use `RouterModule` to set static routes, the only catch is might not work with domain prefix (sub-domain) format. Don't take my word for it as I didn't need to do such tithing so I never looked into it. I suggest you do some research into sub-domains with Angular. – Prav Jun 21 '18 at 14:30