How To Fix nginx: [warn] the “ssl” directive is deprecated (Nginx / VestaCP)

nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl” directive instead in example.com.nginx.ssl.conf este o alerta des intalnita pe web serverele cu configuratii nginx vechi sau cu VestaCP.

nginx -t
How to  fix "ssl" directive is deprecated
SSL directive error in NGINX.conf

Acest warn apare de cele mai multe ori pe seververele care au VestaCP instalat in urma cu cativa ani, cand in configurarea nginx era necesara directiva “ssl on“.

How to Fix ssl” directive is deprecated in Nginx / VestaCP

Metoda 1. Editare fisier nginx.conf pentru domeniu

Cel mai la indemana ne este sa anulam cu # directiva “ssl on” pentru domeniul la care avem nginx warn.

sudo nano /home/vestacpuser/conf/web/example.com.nginx.ssl.conf
# ssl on
Disable SSL directive in NGINX
Disable SSL directive in NGINX

Salvam fisierul si apoi executam iar nginx -t. Eroare nginx: [warn] the “ssl” directive is deprecated…” nu va mai fi prezenta.

nginx -t

Prin acesta metoda, eroarea nu va fi rezolvata permanent. Noile domenii vor respecta fisierul de configurare al pachetului atribuit contului pe VestaCP.

Metoda 2. Editare VestaCP Web Template pentru Nginx.

Inainte sa adaugam un user in VestaCP, trebuie sa cream pachete. VestaCP Packages. Aceste pachete contin mai multe configuratii pentru diferite CMS-uri sau scripturi. Web Template (Nginx), Backend Template (PHP-FPM), DNS Template (NAMED).

Atunci cand adaugam un domeniu pe un user VestaCP, configuratia Nginx default a noului domeniu adaugat va fi data de Web Template (Nginx) selectat pentru pachetul user-ului.

VestaCP Web Template Nginx
VestaCP Web Template Nginx

Luam scenariul in care adaugam Vesta Package Name: Stealth cu Web Template NGINX: wordpress2. Daca template-ul “wordpress2” contine directiva “ssl on”, noile domenii adaugate cu acest template vor avea in configuratie aceasta directiva invechita. Deci cel mai bine este sa modificam Web Template in VestaCP. Atfel noile domenii adaugate sa nu mai primeasca “ssl on” in configuratia Nginx.

Cum editam un Web Template VestaCP ca sa eliminam ssl” directive is deprecated?

Sabloanele care scriu fisierele de config ale domeniilor adaugate sunt localizate in:

/usr/local/vesta/data/templates/web/nginx/php-fpm

Aceste au doua terminatii. .tpl pentru domeniile fara SSL si .stpl pentru domeniile cu SSL activat.

[root@north php-fpm]# pwd
/usr/local/vesta/data/templates/web/nginx/php-fpm
[root@north php-fpm]# ls -all
total 224
drwxr-xr-x 2 root root 4096 Jul  3 23:51 .
drwxr-xr-x 3 root root 4096 Apr 25  2017 ..
-rwxr-xr-x 1 root root 1737 Feb 27 07:12 cms_made_simple.stpl
-rwxr-xr-x 1 root root 1638 Feb 27 07:12 cms_made_simple.tpl
-rwxr-xr-x 1 root root 1770 Feb 27 07:12 codeigniter2.stpl
-rwxr-xr-x 1 root root 1671 Feb 27 07:12 codeigniter2.tpl
-rwxr-xr-x 1 root root 6528 Feb 27 07:12 datalife_engine.stpl
-rwxr-xr-x 1 root root 6429 Feb 27 07:12 datalife_engine.tpl
-rwxr-xr-x 1 root root 1601 Feb 27 07:12 default.stpl
-rwxr-xr-x 1 root root 1502 Feb 27 07:12 default.tpl
-rwxr-xr-x 1 root root 2176 Feb 27 07:12 dokuwiki.stpl
-rwxr-xr-x 1 root root 2076 Feb 27 07:12 dokuwiki.tpl
-rwxr-xr-x 1 root root 2280 Feb 27 07:12 drupal6.stpl
-rwxr-xr-x 1 root root 2177 Feb 27 07:12 drupal6.tpl
-rwxr-xr-x 1 root root 2508 Feb 27 07:12 drupal8.stpl
-rwxr-xr-x 1 root root 2415 Feb 27 07:12 drupal8.tpl
-rwxr-xr-x 1 root root 1949 Feb 27 07:12 joomla.stpl
-rwxr-xr-x 1 root root 1850 Feb 27 07:12 joomla.tpl
-rwxr-xr-x 1 root root 1667 Feb 27 07:12 laravel.stpl
-rwxr-xr-x 1 root root 1562 Feb 27 07:12 laravel.tpl
-rwxr-xr-x 1 root root 5590 Feb 27 07:12 magento.stpl
-rwxr-xr-x 1 root root 5488 Feb 27 07:12 magento.tpl
-rwxr-xr-x 1 root root 1928 Feb 27 07:12 modx.stpl
-rwxr-xr-x 1 root root 1828 Feb 27 07:12 modx.tpl
-rwxr-xr-x 1 root root 2446 Feb 27 07:12 moodle.stpl
-rwxr-xr-x 1 root root 2411 Feb 27 07:12 moodle.tpl
-rwxr-xr-x 1 root root 1303 Feb 27 07:12 no-php.stpl
-rwxr-xr-x 1 root root 1204 Feb 27 07:12 no-php.tpl
-rwxr-xr-x 1 root root 1990 Feb 27 07:12 odoo.stpl
-rwxr-xr-x 1 root root 1891 Feb 27 07:12 odoo.tpl
-rwxr-xr-x 1 root root 1724 Feb 27 07:12 opencart.stpl
-rwxr-xr-x 1 root root 1624 Feb 27 07:12 opencart.tpl
-rwxr-xr-x 1 root root 2796 Feb 27 07:12 owncloud.stpl
-rwxr-xr-x 1 root root 2701 Feb 27 07:12 owncloud.tpl
-rwxr-xr-x 1 root root 2081 Feb 27 07:12 piwik.stpl
-rwxr-xr-x 1 root root 1982 Feb 27 07:12 piwik.tpl
-rw-r--r-- 1 root root  189 Feb 27 07:12 proxy_ip.tpl
-rwxr-xr-x 1 root root 2124 Feb 27 07:12 pyrocms.stpl
-rwxr-xr-x 1 root root 2021 Feb 27 07:12 pyrocms.tpl
-rwxr-xr-x 1 root root 2478 Feb 27 07:12 sendy.stpl
-rwxr-xr-x 1 root root 2390 Feb 27 07:12 sendy.tpl
-rwxr-xr-x 1 root root 1952 Feb 27 07:12 wordpress2_rewrite.stpl
-rwxr-xr-x 1 root root 1859 Feb 27 07:12 wordpress2_rewrite.tpl
-rwxr-xr-x 1 root root 1842 Feb 27 07:12 wordpress2.stpl
-rwxr-xr-x 1 root root 1743 Feb 27 07:12 wordpress2.tpl
-rwxr-xr-x 1 root root 2701 Feb 27 07:12 wordpress2_wp_super_cache.stpl
-rwxr-xr-x 1 root root 2596 Feb 27 07:12 wordpress2_wp_super_cache.tpl
-rwxr-xr-x 1 root root 1601 Feb 27 07:12 wordpress.stpl
-rwxr-xr-x 1 root root 1502 Feb 27 07:12 wordpress.tpl
[root@north php-fpm]# 

Luam scenariul de mai sus, in care avem sablonul “wordpress2.stpl”. Editam acest fisier pe web server si stergem linia cu directiva “ssl on”.

nano /usr/local/vesta/data/templates/web/nginx/php-fpm/wordpress2.stpl
Remove SSL ON Directive in Nginx /. VestaCP
Remove SSL ON Directive in Nginx / VestaCP

Dupa eliminarea liniei “ssl on” din sablon, salvam fisierul. Urmatoarele domenii care vor fi adaugate cu acest sablon, nu vor mai avea directiva invechita. “ssl” directive is deprecated, nu o sa mai apara cand testam nginx.

In acelasi fel se pot modifica toate sabloanele web VestaCP sau se pot crea altele noi in care sa includem configuratii personalizate nginx si php-fpm.

Stealth

Pasionat de tehnologie, imi place sa testez si sa scriu tutoriale despre sistemele de operare macOS, Linux, Windows, despre WordPress, WooCommerce si configurare servere web LEMP (Linux, NGINX, MySQL si PHP). Scriu pe StealthSettings.com din 2006, iar cativa ani mai tarziu am inceput sa scriu pe iHowTo.Tips tutoriale si noutati despre device-uri din ecosistemul Apple: iPhone, iPad, Apple Watch, HomePod, iMac, MacBook, AirPods si accesorii.

Leave a Reply

Your email address will not be published.

Related Articles

/ / /
Tags: / / / /
Back to top button