我已将我的应用程序部署到我的虚拟 linux 机器上,一切正常。
我已将域重定向到我的 ip,它工作正常。问题是当它将我的域重定向到我的 linux 机器 ip 时,url 显示的是我的 ip 而不是域。
这是我的 Nginx 文件:
server {
listen 80;
server_name mydomain.co www.mydomain.co *.mydomain.co;
#return 302 http://www.mydomain.co;
location / {
proxy_pass http://localhost:54662;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
这是我的 Program.cs 文件:
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseKestrel()
.UseUrls("http://*:54662")
.Build();
}