使用certbot和nginx启用SSL

问题描述 投票:0回答:1

你好,stackoverflow社区!

我正在努力在Strapi产品上设置httpS,但是O.O很难我遵循了derrickmehaffy https://medium.com/@derrickmehaffy/using-strapi-in-production-with-https-717af82d1445编写的教程,但是它对我不起作用:'(

我的pm2服务:pm2 configuration

我的/etc/nginx/conf.d/upstream.conf文件:

# 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-availablesites-enabled中的默认软件包,建立了链接,并且当我想使用service nginx configtest检查它时,它失败了

但是,当我启动sudo nginx -t && sudo服务nginx重新加载时,我得到了这个:

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

系统

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

谢谢您的帮助

ssl nginx strapi certbot
1个回答
0
投票

嗨Thann,谢谢您的评论。

© www.soinside.com 2019 - 2024. All rights reserved.