By mrkemaltas
I want to run two or more asp.net core applications on the same server. But the ip and port they use are 127.0.0.1:5000.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
I found a solition ,
asp.net configration;
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls("http://localhost:5001/") // We are here to work at a different port
.Build();
}
nginx configration
server_name yourdomain.com ;
location / {
proxy_pass http://localhost:5001; // Listening 5001 Port
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
}
@mrkemaltas - Please do i need here to use supervisor to make each site always running ? or just set different port for each app in the program.cs file and set in nginx conf file ? if yes can you please provide me sample example of conf files ?
thanks a lot …
For each application you need to do broadcasting and listening through separate ports.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.