大网数据广告活动
服务器运维问答

HTTPS:// is not working on Nginx

· 52CE 我爱测

My domain is: http://indiasaplings.com/ I ran this command: sudo certbot --nginx -d indiasaplings.com -d www.indiasaplings.com It produced this output: IMPORTANT NOTES: Congratulations! Your certificate and chain have been saved …

问题原文

原帖链接 · Brajmohan Kumar · CC BY-SA 4.0

My domain is: http://indiasaplings.com/

I ran this command: sudo certbot --nginx -d indiasaplings.com -d www.indiasaplings.com

It produced this output:

IMPORTANT NOTES:

Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/indiasaplings.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/indiasaplings.com/privkey.pem
Your cert will expire on 2019-12-29. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the “certonly” option. To non-interactively renew all of
your certificates, run “certbot renew”
  • CMS: Mazento 2
  • Web Server: Nginx
  • OS: Ubuntu 18.04
  • Hosting: AWS

Here is my server block:-

server {
   # if ($host = indiasaplings.com) {
    #    return 301 https://$host$request_uri;
   # } # managed by Certbot


    listen 80;
    server_name indiasaplings.com www.indiasaplings.com;
   # return 301 https://indiasaplings.com$request_uri;
    set $MAGE_ROOT /var/www/html/sm/sm_shopee;
    set $MAGE_DEBUG_SHOW_ARGS 1;
    include /etc/nginx/m2/m231.conf;


}

server {
    listen 443 ssl;
    server_name indiasaplings.com www.indiasaplings.com;
  # return 301 https://indiasaplings.com$request_uri;
    set $MAGE_ROOT /var/www/html/sm/sm_shopee;
    set $MAGE_DEBUG_SHOW_ARGS 1;
    include /etc/nginx/m2/m231.conf;
    ssl_certificate /etc/letsencrypt/live/indiasaplings.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/indiasaplings.com/privkey.pem; # managed by Certbot


}

server {
    listen              443 ssl default_server;
    listen              [::]:443 ssl default_server;
    server_name         indiasaplings.com www.indiasaplings.com;
    set $MAGE_ROOT /var/www/hmtl/sm/sm_shopee;
    set $MAGE_DEBUG_SHOW_ARGS 1;
   include /etc/nginx/m2/m231.conf;

    }

I am not able to open my site on HTTPS:// even after installing and configuring Let’s Encrypt. Please guide, Thank you!

已采纳解答

原帖链接 · Gerald Schneider · CC BY-SA 4.0

You have two server blocks with both listen 443 and server_name indiasaplings.com. One has the certificate files configured, the second is missing them. Remove the 443 block without certificate files.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。