2016-07-16 20 views
5

私の@home Webサーバー(無料!:O)で私のSSLにhttps://github.com/ebekker/ACMESharpを使用しています。これはかなり手作業でしたが、Wikiには、https://github.com/Lone-Coder/letsencrypt-win-simpleという別のプロジェクトがあります。このプロジェクトは、SSL証明書をWebサーバーに適用、ダウンロード、インストールするためのGUIでした。.netcoreアプリケーションのwwwroot以外の静的ファイル

GUIがドメインを検証するために使用する方法はあなたのものであり、拡張子なしのランダムな文字列を[webroot]/.well-known/[randomFile]内に含むランダムな名前のファイルが作成されます。 .dotnetcoreアプリケーションがこの[webroot]で実行されているため、IISで「ハンドラマッピング」を変更する手順を行った後でも、ファイルを提供できません。

[webRoot]/wwwroot/[whatever]で直接ファイルにアクセスできるようですが、どうして私は[webroot]/.well-known/[randomFile]に参加できませんか?

誰もがこのことを知っていますか?私は.netcoreアプリを削除してSSL証明書のインストールを実行することができますが、このインストールは2〜3ヶ月ごとに行われる必要があります。マニュアルでは正しい方法を理解することをお勧めします。

答えて

3

私はここに必要な情報が見つかりました:これまで

 // allows for the direct browsing of files within the wwwroot folder 
     app.UseStaticFiles(); 

     // MVC routes 
     app.UseMvc(routes => 
     { 
      routes.MapRoute(
       name: "default", 
       template: "{controller=Home}/{action=Index}/{id?}"); 
     }); 

 // allows for the direct browsing of files within the wwwroot folder 
     app.UseStaticFiles(); 

     // Allow static files within the .well-known directory to allow for automatic SSL renewal 
     app.UseStaticFiles(new StaticFileOptions() 
     { 
      ServeUnknownFileTypes = true, // this was needed as IIS would not serve extensionless URLs from the directory without it 
      FileProvider = new PhysicalFileProvider(
        Path.Combine(Directory.GetCurrentDirectory(), @".well-known")), 
      RequestPath = new PathString("/.well-known") 
     }); 

     // MVC routes 
     app.UseMvc(routes => 
     { 
      routes.MapRoute(
       name: "default", 
       template: "{controller=Home}/{action=Index}/{id?}"); 
     }); 

EDIT - 注私はこれを変更するために必要な私のStatup.csにおける基本的https://docs.asp.net/en/latest/fundamentals/static-files.html

をこのディレクトリ "。well-known"はWebサーバー上でのみ作成されたため、私はローカルで再度開発を始めたときにエラーが発生しました。 "。well-known"ディレクトリは存在しませんでした。だから私は自分のプロジェクトに空のディレクトリを持っていますが、少なくとも私のSSLの更新は自動化されています! :D

関連する問題