USE HTTPS in C# by Running the Container with a Certificate

This article was translated from English: Does it need improvement?
Translated
View the article in English

Kapsayıcıyı bir sertifikalı çalıştırmanız gerekiyorsa, sertifikayı oluşturma ve yerel makineyi yapılandırma adımlarını izleyin:

Bir Sertifikayla IronSecureDoc Kapsayıcısını Çalıştırın

  1. Sertifika Oluştur:

    # Generates a new HTTPS certificate for use with ASP.NET Core.
    # Saves the certificate at the specified path and protects it with a password.
    dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>
    
    # Trusts the generated certificate on your local machine.
    dotnet dev-certs https --trust
    # Generates a new HTTPS certificate for use with ASP.NET Core.
    # Saves the certificate at the specified path and protects it with a password.
    dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>
    
    # Trusts the generated certificate on your local machine.
    dotnet dev-certs https --trust
    SHELL

    <CREDENTIAL_PLACEHOLDER> ifadesini bir şifre ile değiştirin.

  2. Docker Kapsayıcısını Çalıştır:

    # Runs the IronSecureDoc Docker container with both HTTP and HTTPS ports exposed.
    docker container run -d \
     -p 8081:8081 -p 8080:8080 \ # Maps container ports to host ports for HTTP and HTTPS.
     -e HTTP_PORTS=8080 \ # Sets the HTTP port for the application.
     -e HTTPS_PORTS=8081 \ # Sets the HTTPS port for the application.
     -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \ # Provides the IronSecureDoc license key.
     -e ENVIRONMENT=Production \ # Configures the environment as Production.
     -v %USERPROFILE%\.aspnet\https:/https:ro \ # Mounts the directory to the container as read-only.
     -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx \ # Specifies the path to the certificate in the container.
     -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \ # Password for the certificate.
     ironsoftwareofficial/ironsecuredoc:latest # Specifies the Docker image to use.
    # Runs the IronSecureDoc Docker container with both HTTP and HTTPS ports exposed.
    docker container run -d \
     -p 8081:8081 -p 8080:8080 \ # Maps container ports to host ports for HTTP and HTTPS.
     -e HTTP_PORTS=8080 \ # Sets the HTTP port for the application.
     -e HTTPS_PORTS=8081 \ # Sets the HTTPS port for the application.
     -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \ # Provides the IronSecureDoc license key.
     -e ENVIRONMENT=Production \ # Configures the environment as Production.
     -v %USERPROFILE%\.aspnet\https:/https:ro \ # Mounts the directory to the container as read-only.
     -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx \ # Specifies the path to the certificate in the container.
     -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \ # Password for the certificate.
     ironsoftwareofficial/ironsecuredoc:latest # Specifies the Docker image to use.
    SHELL

    <IRONSECUREDOC_LICENSE_KEY> ve <CERTIFICATE_PASSWORD> yerlerini sırasıyla gerçek IronSecureDoc lisans anahtarınız ve sertifika şifrenizle değiştirin.

Sıkça Sorulan Sorular

Belge güvenliği için HTTPS neden önemlidir?

HTTPS, belgelerin güvenliği için önemlidir çünkü aktarımı yapılan verileri şifreler, böylece hassas bilgilerin aktarım sırasında gizli kalmasını ve kesilmeden korunmasını sağlar.

Uygulamam için bir HTTPS sertifikasını nasıl oluşturabilirim?

ASP.NET Core ile kullanım için yeni bir sertifika oluşturacak dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p komutunu çalıştırarak bir HTTPS sertifikası oluşturabilirsiniz.

Yerel makinemde HTTPS sertifikamın güvenilir olmasını nasıl sağlayabilirim?

Yerel makinelerde HTTPS sertifikasını düzgün şekilde güvenilir kılmak için dotnet dev-certs https --trust komutunu çalıştırın. Bu komut, sisteminizi oluşturulan sertifikanın güvenilir hale gelmesi için yapılandırır.

HTTPS desteği ile bir Docker konteynerini çalıştırma işlemi nasıldır?

HTTPS desteği için, HTTP ve HTTPS portlarını açarak, IronSecureDoc_LicenseKey ve CERTIFICATE_PASSWORD gibi gerekli çevre değişkenlerini ayarlayıp sertifika dizinini salt okunur olarak mount ederek bir Docker konteynerini çalıştırın.

Docker yapılandırmasında HTTPS için hangi portlar yapılandırılmalıdır?

Docker yapılandırmasında HTTPS için, konteyner portlarını barındırıcı portlarına eşleştirerek port 8081'i HTTPS, port 8080'i HTTP için açın.

Sertifika şifresini Docker konteynerine nasıl iletebilirim?

Docker çalıştırma komutunu çalıştırırken environment variable CERTIFICATE_PASSWORD kullanılarak sertifika şifresini Docker konteynerine iletin.

Docker'da ortamı 'Production' olarak yapılandırmak için gerekli adımlar nelerdir?

Docker'da ortamı 'Production' olarak yapılandırmak için, Docker çalıştırma komutunuzda ENVIRONMENT=Production çevre değişkenini ayarlayın.

Docker komutlarında placeholder'lar nasıl ele alınmalı?

Docker komutlarında placeholder'ları, ve gibi sembolleri gerçek IronSecureDoc lisans anahtarınız ve sertifika şifrenizle değiştirerek işlevselliği sağlamak için uygun şekilde doldurun.

Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapı...

Daha Fazla Oku
Başlamaya Hazır mısınız?
Sürüm: 2024.10 just released
Still Scrolling Icon

Hâlâ Kaydırıyor Musunuz?

Hızlıca kanıt ister misiniz?
bir örnek çalıştırın PDF'nizin şifrelenmesini izleyin.