简体   繁体   English

如何配置 Nginx 以通过注册域访问 Asp.Net Web 应用程序

[英]How to configure Nginx for Asp.Net web app access through registered Domain

i'm looking for some help on setting up nginx properly so i can access my asp.net web app through my domain.我正在寻找有关正确设置 nginx 的帮助,以便我可以通过我的域访问我的 asp.net Web 应用程序。 I reviewed several discussions however nothing seemed to help.我回顾了几次讨论,但似乎没有任何帮助。

Below is my current setup:以下是我目前的设置:

  1. Nginx installed and configured (will post my config file below) Nginx 安装和配置(将在下面发布我的配置文件)
  2. GoDaddy domain DNS configured for DigitalOcean为 DigitalOcean 配置的 GoDaddy 域 DNS
  3. .net app located in /var/www/publish directory. .net 应用程序位于 /var/www/publish 目录中。
  4. When navigating to www.jeansmax.com (temporary domain) - it shows the default nginx page.导航到 www.jeansmax.com(临时域)时 - 它显示默认的 nginx 页面。
  5. ..nginx/sites-available is linked in sites-enabled ..nginx/sites-available 链接在启用了站点的站点中
  6. .net app runs if I run it locally localhost:5000如果我在本地运行 .net 应用程序 localhost:5000
  7. Also my app startup.cs has the UseForwardedHeaders code below as well.我的应用程序 startup.cs 也有下面的 UseForwardedHeaders 代码。
  8. Not sure what the issue is...any help is appreciated不知道问题是什么......任何帮助表示赞赏

nginx config nginx 配置

server {
    listen        80;
    server_name   jeansmax.com *.jeansmax.com;
    location / {
        proxy_pass         http://localhost:5000;
        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;
    }
}

server {
    listen   80 default_server;
    # listen [::]:80 default_server deferred;
    return   444;
}

UseForwardedHeaders code使用ForwardedHeaders 代码

app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseRouting();
            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });
            app.UseAuthentication();
            app.UseAuthorization();

I resolved my issue after updating the following below:更新以下内容后,我解决了我的问题:

  1. Configured DNS for AAAA - IPv6为 AAAA 配置的 DNS - IPv6
  2. Updated my nginx config file for HTTPS instead of HTTP proxy为 HTTPS 而不是 HTTP 代理更新了我的 nginx 配置文件
  3. Installed Lets Encrypt plugin for Nginx为 Nginx 安装 Lets Encrypt 插件
  4. Ran certbot again and received a successful certificate.再次运行 certbot 并收到成功的证书。
  5. Restarted my application service重新启动我的应用程序服务
  6. Restarted my nginx service重新启动我的 nginx 服务
  7. my domain fired up and working now.我的域已启动并正在工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何验证ASP.NET Web应用程序以访问SQL数据库 - How to authenticate an asp.net web app to access sql database 如何配置 ASP.net 核心与 kube.netes NGINX 入口一起工作 - How to configure ASP.net Core to work with kubernetes NGINX ingress 远程访问本地 ASP.NET Core 应用程序 NGINX - Remote Access to Local ASP.NET Core app NGINX 如何在Windows Azure Web App上发布的asp.net网站中访问Web服务 - How to to access web service in asp.net web site whcih publish on windows azure Web App 通过Silverlight应用程序访问asp.net Web应用程序中的文件夹 - access to a folder in asp.net web application through silverlight application 如何在asp.net Web应用程序客户端上配置UrlRewritingNet - How to Configure UrlRewritingNet on asp.net web application client end 通过ASP.NET Web App中的HTTP POST接收XML - Receive XML Through HTTP POST In ASP.NET Web App 如何配置ASP.Net网站以访问Active Directory - How to configure ASP.Net website to have access to Active Directory 我没有注册服务的 web api asp.net mvc6 应用程序异常 - Exception on web api asp.net mvc6 app that i did not registered a service 如何通过asp.net Web服务传递对象 - how to pass object through asp.net web service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM