إضافة شهادة SSL

لقد اشتريت شهادة SSL واتبعت التعليمات الموجودة في:

Allow SSL / HTTPS for your Discourse Docker setup - Documentation / Self-Hosting - Discourse Meta
والتي تضمنت وضع ssl.key و ssl.crt في /var/discourse/shared/standalone/ssl/ وإضافة القوالب الإضافية إلى app.yml.

كان الموقع يعمل بشكل مثالي من قبل ولكن بمجرد تمكين SSL، تعطل وأعطى خطأ “Unable to connect” أو “Server not found”.

2024/06/13 09:25:08 [emerg] 5152#5152: cannot load certificate "/shared/ssl/communities-dev.np.norton.com.cer": PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no>
2024/06/13 09:25:09 [warn] 5182#5182: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/discourse.conf:60

هذا هو ملف app.yml الخاص بي

##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed


templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  ## Uncomment the next line to enable the IPv6 listener
  #- "templates/web.ipv6.template.yml"
  - "templates/web.ratelimited.template.yml"
  ## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"


## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "80:80"   # http
  - "2222:22"
  - "443:443" # https


## The http or https CDN address for this Discourse instance (configured to pull)
## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## The maxmind geolocation IP account ID and license key for IP address lookups
## see https://meta.discourse.org/t/-/173941 for details
  #DISCOURSE_MAXMIND_ACCOUNT_ID: 123456
  #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456
  DISCOURSE_USE_SSL: true
  DISCOURSE_SSL_CERTIFICATE_PATH: /var/discourse/shared/standalone/ssl/domain-name.cer
  DISCOURSE_SSL_KEY_PATH: /var/discourse/shared/standalone/ssl/domain-name.key
  DISCOURSE_SSL_CA_PATH: /var/discourse/shared/standalone/ssl/intermediate.cer

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

هل يمكن لأحد المساعدة؟

لا يجب عليك تمكين هذا القالب إذا كنت لا تستخدم Let’s Encrypt.
سيتم تغيير مسار الشهادة.

هل هناك سبب محدد لعدم رغبتك في استخدام شهادة Let’s Encrypt الافتراضية؟ إنها أسهل بكثير بهذه الطريقة.

لقد قدم لي فريقي شهادة SSl من digicert وقمت بإضافة تلك الشهادة والمفتاح الخاص والشهادة الوسيطة إلى هذا الموقع /var/discourse/shared/standalone/ssl
وقمت أيضًا بإجراء بعض التغييرات في ملف app.yml الذي أضفته في المنشور.
أعتقد أنني أفتقد الكثير من الأشياء هنا، هل يمكنك توضيح ما أفعله بشكل خاطئ. أنا منفتح على كل حل.

لماذا؟

هل أنت خلف جدار حماية؟ إذا لم يكن الأمر كذلك، فإن التثبيت القياسي سيحصل على شهادة مجانية وسيعمل بشكل طبيعي.