@ymenaidtopa

Почему Certbot не находит плагин под NGINX?

Выполняю команду: sudo certbot --nginx

Выдает:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
The requested nginx plugin does not appear to be installed


Статус NGINX:
systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2023-01-04 12:44:03 EST; 2s ago
  Process: 2553 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 2550 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 2554 (nginx)
   CGroup: /system.slice/nginx.service
           ├─2554 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           ├─2555 nginx: worker process                           
           └─2556 nginx: worker process                           

Jan 04 12:44:03 vm2101602 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jan 04 12:44:03 vm2101602 systemd[1]: Started A high performance web server and a reverse proxy server.


Логи /var/log/letsencrypt/letsencrypt.log:
2023-01-04 12:43:19,666:DEBUG:certbot.main:certbot version: 0.27.0
2023-01-04 12:43:19,667:DEBUG:certbot.main:Arguments: ['--nginx']
2023-01-04 12:43:19,667:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2023-01-04 12:43:19,682:DEBUG:certbot.log:Root logging level set at 20
2023-01-04 12:43:19,683:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2023-01-04 12:43:19,684:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2023-01-04 12:43:19,685:DEBUG:certbot.plugins.selection:No candidate plugin
2023-01-04 12:43:19,685:DEBUG:certbot.plugins.selection:Selected authenticator None and installer None
2023-01-04 12:44:44,471:DEBUG:certbot.main:certbot version: 0.27.0
2023-01-04 12:44:44,472:DEBUG:certbot.main:Arguments: ['--nginx']
2023-01-04 12:44:44,472:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2023-01-04 12:44:44,485:DEBUG:certbot.log:Root logging level set at 20
2023-01-04 12:44:44,485:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2023-01-04 12:44:44,486:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2023-01-04 12:44:44,486:DEBUG:certbot.plugins.selection:No candidate plugin
2023-01-04 12:44:44,486:DEBUG:certbot.plugins.selection:Selected authenticator None and installer None
2023-01-04 12:46:21,155:DEBUG:certbot.main:certbot version: 0.27.0
2023-01-04 12:46:21,156:DEBUG:certbot.main:Arguments: ['--nginx']
2023-01-04 12:46:21,156:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2023-01-04 12:46:21,170:DEBUG:certbot.log:Root logging level set at 20
2023-01-04 12:46:21,171:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2023-01-04 12:46:21,171:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2023-01-04 12:46:21,172:DEBUG:certbot.plugins.selection:No candidate plugin
2023-01-04 12:46:21,172:DEBUG:certbot.plugins.selection:No candidate plugin
2023-01-04 12:46:21,172:DEBUG:certbot.plugins.selection:Selected authenticator None and installer None
2023-01-04 12:46:21,172:INFO:certbot.main:Could not choose appropriate plugin: The requested nginx plugin does not appear to be installed
2023-01-04 12:46:21,173:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==0.27.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 1364, in main
    return config.func(config, plugins)
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 1233, in certonly
    installer, auth = plug_sel.choose_configurator_plugins(config, plugins, "certonly")
  File "/usr/lib/python2.7/dist-packages/certbot/plugins/selection.py", line 237, in choose_configurator_plugins
    diagnose_configurator_problem("authenticator", req_auth, plugins)
  File "/usr/lib/python2.7/dist-packages/certbot/plugins/selection.py", line 341, in diagnose_configurator_problem
    raise errors.PluginSelectionError(msg)
PluginSelectionError: The requested nginx plugin does not appear to be installed
2023-01-04 12:46:50,641:DEBUG:certbot.main:certbot version: 0.27.0
2023-01-04 12:46:50,642:DEBUG:certbot.main:Arguments: ['--nginx']
2023-01-04 12:46:50,642:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2023-01-04 12:46:50,655:DEBUG:certbot.log:Root logging level set at 20
2023-01-04 12:46:50,656:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2023-01-04 12:46:50,657:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2023-01-04 12:46:50,657:DEBUG:certbot.plugins.selection:No candidate plugin
2023-01-04 12:46:50,657:DEBUG:certbot.plugins.selection:Selected authenticator None and installer None
  • Вопрос задан
  • 4600 просмотров
Решения вопроса 1
@dronmaxman
VoIP Administrator
В 16.04 нет пакета python-certbot-nginx поэтому все делаем руками.

## Ставим CertBot
sudo apt-get install certbot

## Создаем папку
sudo mkdir -p /var/www/cert_bot/.well-known/acme-challenge
sudo chown -R www-data:www-data /var/www/cert_bot

## Создаем базовый конфиг в /etc/nginx/site-enable/default 
server {
          listen  80;
          
          server_name  _;
        root /var/www/cert_bot;

        location /.well-known/acme-challenge/ {
                access_log off;
                default_type "text/plain";
        }
        location / {
                return 301 https://$server_name$request_uri;
                }
}

## Пробуем запросить сертификат
sudo certbot certonly --dry-run--webroot --agree-tos --email hostmaster@domain.com -w /var/www/cert_bot/ -d domain.com 

## Если все ок, заправиваем без --dry-run
sudo certbot certonly --webroot --agree-tos --email hostmaster@domain.com -w /var/www/cert_bot/ -d domain.com 

## Добавляем конфиг с SSL /etc/nginx/site-enable/domain-ssl
server {
        listen   443 ssl;
       
        server_name domain.com;
        

        ssl                  on;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/domain.com/privkey.pem;
        #ssl_dhparam /etc/nginx/dhparam.pem;

        root /var/www/html
}

## Добавляем в крон автообновление сертификата 
sudo crontab -e -u root
0 0 10,25 * * certbot renew
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 2
karabanov
@karabanov
Системный администратор
apt install python3-certbot-nginx
Ответ написан
ky0
@ky0 Куратор тега Nginx
Миллиардер, филантроп, патологический лгун
Почему Certbot не находит плагин под NGINX?

Потому что актуальная версия Убунты - 22, а у вас 16. Обновитесь.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы