Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom domain instead of localhost - Angular

Development purpose I want to start my Angular application with custom-domain instead of localhost

Is any other way available?

I am able to find solutions for php but I didn't find solutions for the angular application.

like image 906
Sathia Avatar asked Feb 07 '26 08:02

Sathia


1 Answers

Update your angular.json

This is what you should do:

"projects": {
    "project-name": {
        ...
        "architect": {
            "serve": {
                "options": {
                  "host": "customdomain.baz",
                  "port": 80
                }
            }
        }
    }
}

Update your host file if you are on mac/ linux

go to /etc/hosts

##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1       customdomain.baz // or whatever your domain is
255.255.255.255 broadcasthost
::1             localhost
like image 164
Vikas Avatar answered Feb 09 '26 09:02

Vikas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!