Работают ли настройки через файл nginx.ваш_домен.conf_custom Topic is solved
-
- Posts: 12
- Joined: Sat Jan 07, 2017 11:00 pm
Работают ли настройки через файл nginx.ваш_домен.conf_custom
Здравствуйте, работаю ли настройки 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;
}
-
- Support team
- Posts: 1047
- Joined: Fri Mar 21, 2014 7:49 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Есть в документации ответ на ваш вопрос http://vestacp.com/docs/#how-to-force-https
How to force https/SSL on a domain
1. Install custom nginx template3. Create new package or set force-https as nginx template in the existing packageCode: 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
4. Add new user and assing him package with force-https template
5. Add new domain with SSL certificate and check the result
-
- Posts: 12
- Joined: Sat Jan 07, 2017 11:00 pm
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Ключевой вопрос работают ли настройки ngins через файл nginx.ваш_домен.conf_custom в /home/admin/conf/web/, про указанный вами способ знаю.Alex Connor wrote: ↑Tue Aug 14, 2018 11:19 amЕсть в документации ответ на ваш вопрос http://vestacp.com/docs/#how-to-force-httpsHow to force https/SSL on a domain
1. Install custom nginx template3. Create new package or set force-https as nginx template in the existing packageCode: 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
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
Работают. Просто надо почитать как работают локейшены в nginx.
Поэтому у себя в темплейтах я использую в начале шаблона, до первого location:
Попутно использую похожий инклуд для настройки php под конкретный сайт
Рекомендую взять на вооружение)
Поэтому у себя в темплейтах я использую в начале шаблона, до первого location:
Code: Select all
include %home%/%user%/conf/web/pre.%domain%.conf*;
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*;
}
-
- Posts: 12
- Joined: Sat Jan 07, 2017 11:00 pm
Re: Работают ли настройки через файл nginx.ваш_домен.conf_custom
Спасибо !)Stesh wrote: ↑Fri Aug 17, 2018 1:35 pmРаботают. Просто надо почитать как работают локейшены в nginx.
Поэтому у себя в темплейтах я использую в начале шаблона, до первого location:Попутно использую похожий инклуд для настройки php под конкретный сайтCode: Select all
include %home%/%user%/conf/web/pre.%domain%.conf*;
Рекомендую взять на вооружение)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*; }