Включить SSL с помощью certbot и nginx - PullRequest
0 голосов
/ 10 апреля 2020

Привет сообществу stackoverflow!

Я пытаюсь установить httpS на моем производстве Strapi, но это очень сложно. OO Я следовал учебнику, написанному derrickmehaffy https://medium.com/@derrickmehaffy / using-strapi-in- production-with-https-717af82d1445 , но у меня это не работает: '(

Мой сервис pm2: конфигурация pm2

Мой / etc / nginx /conf.d/upstream.conf file:

# Strapi upstream server
upstream strapi-gatsby {
    server localhost:1337;
}

Мой /etc/nginx/sites-available/strapi.live-for-good.org.conf файл:

server {
# Listen HTTP
    listen 80;
    server_name strapi.live-for-good.org;
# Define LE Location
    location ~ ^/.well-known/acme-challenge/ {
      default_type "text/plain";
      root         /var/www/html;
    }
# Else Redirect to HTTPS // API
#    location / {
#      return 301 https://$host$request_uri;
#    }
}

Я очистил пакет по умолчанию в sites-available и sites-enabled , сделал ссылку, и когда я захотел проверить его с помощью service nginx configtest, он не работает

Но, когда я запускаю sudo nginx -t && sudo service nginx reload , я получил это:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

System

Node.js version: 12.16.1
NPM version: 6.13.4
Strapi version: 3.0.0-beta.19.3
Database: mongoDB on MLab
Operating system: ubuntu 18.04

Спасибо за помощь

1 Ответ

0 голосов
/ 10 апреля 2020

Привет, спасибо за ваши комментарии.

Когда я захожу на http: // strapi.live-for-good.org, я получаю приветственное сообщение от Nginx.

https: // strapi.live-for-good.org:

This site can’t be reached
strapi.live-for-good.org refused to connect. 
Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED 

https: // strapi.live-for-good.org:1337:

This site can’t provide a secure connection
strapi.live-for-good.org sent an invalid response. 
ERR_SSL_PROTOCOL_ERROR 

http: // strapi.live-for-good.org:1337 все еще работает без SSL

...