Certbot cant Deploying Certificate

Also, this section, unlike the others, has both HTTP and HTTPS in the same server block:
[and also contains some IF statements that don’t cover any ELSE/NOT IF condition]
[ — condensed/indented/commented for clarity — ]

# configuration file /etc/nginx/conf.d/yueole.club.conf:
server {
   listen 80; # HTTP <<<<<<<<<<<<<<<<<
   server_name yueole.club;
   listen 443 ssl; # HTTPS <<<<<<<<<<<<<<<<<
   ssl_certificate /etc/letsencrypt/live/yueole.club/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/yueole.club/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
   root /var/web/v2vitrina;
   access_log /var/log/nginx/v2vitrina.access.log elk;
   error_log /var/log/nginx/v2vitrina.error.log;
   index index.php;
   charset utf-8;
   autoindex off;
   location ~ /(manifest.json|serviceworker.js|serviceworker-update.js) {
      fastcgi_pass unix:/var/run/php-fpm/php7.2-fpm.sock;
      fastcgi_index mirror_scripts.php;
      include fastcgi_params;
      fastcgi_read_timeout 1800;
      fastcgi_param SCRIPT_FILENAME $document_root/mirror_scripts.php;
   }#location
   location /pwa {
      root /var/web/week-news24.ru;
      index index.html;
   }#location
   location /article {
      rewrite ^/article/base/([0-9]+)/*$  /index.php?do=base&id=$1  last;
      rewrite ^/article/short/([0-9]+)/*$ /index.php?do=short&id=$1 last;
      rewrite ^/article/full/([0-9]+)/*$  /index.php?do=full&id=$1  last;
   }#location
   location /admin { rewrite ^(.*)$ https://admin.weekpaper.club permanent; }#location
   location /new   { rewrite ^/new/*$ /index.php?do=new last; }#location
   location /top   { rewrite ^/top/(base|short|full)/*$ /index.php?do=top&op=$1 last; }#location
   location /main  { rewrite ^/main/*$ /index.php?do=tovar last; }#location
   location / {
      if (!-e $request_filename){
         rewrite ^/([^./]+)/*$ /index.php?do=cat&furl=$1 last;
      }#if
      #else ? ? ? ? ? ?
   }#location
   expires $expires;
   location ~* \.php$ {
      fastcgi_pass unix:/var/run/php-fpm/php7.2-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_read_timeout 1800;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }#location
   location = /favicon.ico {
      log_not_found off;
      access_log off;
   }#location
   location = /robots.txt {
      allow all;
      log_not_found off;
      access_log off;
   }#location
   location ~ /\. {
      deny all;
      log_not_found off;
   }#location
   location ~* (dev|logs) {
      deny all;
      log_not_found off;
   }#location
}#server
server {
   if ($host = yueole.club) {
      return 301 https://$host$request_uri;
   }#if
   #else ? ? ? ? ? ?
}#server

thanks, I replaced the configuration with this:

conf

server {
listen 80;
server_name
yueole.club;
return 301 https://$host$request_uri;
}

server {
listen 443 ssl; # managed by Certbot
server_name yueole.club;

}

and everything works correctly.
In general, I still did not understand what the problem was, but I tried to put domain names on one line and on each line. This did not help.
Maybe due to the fact that the rest of the configs have scattered names like this?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.