Page 1 of 1
Работают ли настройки через файл nginx.ваш_домен.conf_custom
Posted: Mon Aug 13, 2018 7:17 pm
by DreamerKlim
Здравствуйте, работаю ли настройки ngins через файл nginx.ваш_домен.conf_custom в /home/admin/conf/web/ ? Не могу никак добиться перенаправление c HHTP на HTTPS.
Используовал это
Code: Select all
if ( $scheme = "http" ) {
rewrite ^/(.*)$ https://$host/$1 permanent;
}
И это
Code: Select all
location / {
rewrite ^(.*) https://%domain_idn%$1 permanent;
}
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Posted: Tue Aug 14, 2018 11:19 am
by Alex Connor
Есть в документации ответ на ваш вопрос
http://vestacp.com/docs/#how-to-force-https
How to force https/SSL on a domain
1. Install custom nginx template
Code: Select all
cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/rhel/force-https/nginx.tar.gz
tar -xzvf nginx.tar.gz
rm -f nginx.tar.gz
3. Create new package or set force-https as nginx template in the existing package
4. Add new user and assing him package with force-https template
5. Add new domain with SSL certificate and check the result
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Posted: Tue Aug 14, 2018 3:31 pm
by DreamerKlim
Alex Connor wrote: Tue Aug 14, 2018 11:19 am
Есть в документации ответ на ваш вопрос
http://vestacp.com/docs/#how-to-force-https
How to force https/SSL on a domain
1. Install custom nginx template
Code: Select all
cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/rhel/force-https/nginx.tar.gz
tar -xzvf nginx.tar.gz
rm -f nginx.tar.gz
3. Create new package or set force-https as nginx template in the existing package
4. Add new user and assing him package with force-https template
5. Add new domain with SSL certificate and check the result
Ключевой вопрос работают ли настройки ngins через файл nginx.ваш_домен.conf_custom в /home/admin/conf/web/, про указанный вами способ знаю.
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Posted: Fri Aug 17, 2018 1:35 pm
by Stesh
Работают. Просто надо почитать как работают локейшены в nginx.
Поэтому у себя в темплейтах я использую в начале шаблона, до первого location:
Code: Select all
include %home%/%user%/conf/web/pre.%domain%.conf*;
Попутно использую похожий инклуд для настройки php под конкретный сайт
Code: Select all
location ~ \.php$ {
try_files $uri = 404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
include %home%/%user%/conf/web/php.%domain%.conf*;
}
Рекомендую взять на вооружение)
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Posted: Sat Aug 18, 2018 4:16 am
by DreamerKlim
Stesh wrote: Fri Aug 17, 2018 1:35 pm
Работают. Просто надо почитать как работают локейшены в nginx.
Поэтому у себя в темплейтах я использую в начале шаблона, до первого location:
Code: Select all
include %home%/%user%/conf/web/pre.%domain%.conf*;
Попутно использую похожий инклуд для настройки php под конкретный сайт
Code: Select all
location ~ \.php$ {
try_files $uri = 404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
include %home%/%user%/conf/web/php.%domain%.conf*;
}
Рекомендую взять на вооружение)
Спасибо !)