Deployed the .Net Core WebAPI in Linux and want to browse the application using domain name instead of IP of the system

Swornatoya

New Member
Joined
Apr 29, 2022
Messages
3
Reaction score
0
Credits
28
I deployed the .NET core web API in Linux using the below command.

sudo docker run -dt -e "ASPNETCORE_URLS=https://+;http://+" -e ASPNETCORE_Kestrel__Certificates__Default__Password="password" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/<certificate.pfx> -v "<certificate path>/:/https/" -p 8081:80 -p 8080:443 --name <name> <image name>

But I am unable to map the domain name of the certificate used here to browse my API. I am able to browse it using the system IP.

I want to browse my API using the domain name instead of the IP
 


Your first post and it's regarding using windoze software?
Not a good idea in a Linux forum!
 
But I am unable to map the domain name of the certificate used here to browse my API. I am able to browse it using the system IP.

I want to browse my API using the domain name instead of the IP

domain names are a science unto themselves.
First, are you running internal DNS? No domain without DNS.
Sometimes your ISP will give fully qualified machine names. Often they do not.

So you might have something like mycoolcomputer.xfinity.net
But more likely it's not a FQDN ( fully qualified domain name)
In which case it might be something like mycoolcomputer (without the domain suffix)
Often you can use the /etc/hosts file to fool your computer
Add a line like...

10.3.4.5 mycoolcomputer.mycooldomain.com

Obviously use the IP of your computer. Not the IP in the example above.

You may want to run your own DNS server ( domain name server ) to keep from having to do this.
If you want it to resolve out on the internet you'll have to register your domain name.
Now that's typically the two ways Linux handle's it.

However "domain name" is a little misleading in Microsoft terminology. Sometimes they mean internet DNS,
but often they mean Active Directory domain. There is some overlap between the two, but they aren't
the same thing at all.

If you don't want to pay Microsoft for a Windoze based domain controller, you can use something called
Samba to run active directory on Linux.

 
domain names are a science unto themselves.
First, are you running internal DNS? No domain without DNS.
Sometimes your ISP will give fully qualified machine names. Often they do not.

So you might have something like mycoolcomputer.xfinity.net
But more likely it's not a FQDN ( fully qualified domain name)
In which case it might be something like mycoolcomputer (without the domain suffix)
Often you can use the /etc/hosts file to fool your computer
Add a line like...

10.3.4.5 mycoolcomputer.mycooldomain.com

Obviously use the IP of your computer. Not the IP in the example above.

You may want to run your own DNS server ( domain name server ) to keep from having to do this.
If you want it to resolve out on the internet you'll have to register your domain name.
Now that's typically the two ways Linux handle's it.

However "domain name" is a little misleading in Microsoft terminology. Sometimes they mean internet DNS,
but often they mean Active Directory domain. There is some overlap between the two, but they aren't
the same thing at all.

If you don't want to pay Microsoft for a Windoze based domain controller, you can use something called
Samba to run active directory on Linux.


I tried adding the domain name near the IP of my computer in the etc/hosts file. But it still did not work. And I get as below:

1651658361848.png
 
Just run your application in a container and then install nginx or apache on your system and so that you can then reverse proxy the port for your application is running on. That way you can define the domain name in the nginx or apache configuration and you don't have to worry about domain names in your container.
 
Last edited:
The certificate provided to be used in the application is organization specific. So had to use that.

Please suggest if apache or kestrel is a better option for deploying the .net core api in Linux machine using the ssl certificate.
 
You are going to have to give more details, but in general it shouldn't matter where you place to certificate. Placing the certificate in the nginx or apache configuration will give you an encrypted connection as well when reverse proxying the local port in the container through apache or nginx. When using a reverse proxy, nginx is more more popular in most cases because it is more lightweight than Apache. If it an self created organizational CA then you would have to make sure the chain is known in the nginx or apache configuration and in the browser of the clients that will be accessing the application. Lastly I never understand why people from a company are asking for advice on a forum, the average company should have plenty of capable people of figuring out a solution themselves.
 

Members online


Latest posts

Top