Force SSL on Vesta without Apache (nginx + php-fpm)
Force SSL on Vesta without Apache (nginx + php-fpm)
I'm running VestaCP on nginx + php-fpm stack (no Apache) and want to force SSL connections for my domains but it doesn't seem like Vesta is prepared to handle this kind of configuration.
I tried forcing it as documented in docs http://vestacp.com/docs/#how-to-force-https but force-https template works only if you use Apache with Nginx as proxy server.
On nginx + php-fpm stack Vesta looks for php-fpm templates in but there's many of them so every single one would require something like:
Is there a more centralised way of doing it?
I tried forcing it as documented in docs http://vestacp.com/docs/#how-to-force-https but force-https template works only if you use Apache with Nginx as proxy server.
On nginx + php-fpm stack Vesta looks for php-fpm templates in
Code: Select all
/usr/local/vesta/data/templates/web/nginx/php-fpm
Code: Select all
server {
listen 80;
server_name mysite.com;
return 301 https://$server_name$request_uri;
}
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
Try forcing https using php. Check this tutorial on how to force https using php https://blog.flaunt7.com/force-https-php-htaccess/
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
templates, I thinkNinetou wrote:Is there a more centralised way of doing it?
-
- Posts: 3
- Joined: Fri Jan 26, 2018 6:33 pm
- Contact:
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
Hello,
I was looking for the exact same thing, in the docs it is only noted for apache installs. So I duplicated the default template files, in the http template it redirects to SSL, in SSL template there is a if statement to detect the www. Simply download, extract and place the files into
Files are available at GitHub https://github.com/cybersholt/VestaCP-Nginx-Force-SSL
I was looking for the exact same thing, in the docs it is only noted for apache installs. So I duplicated the default template files, in the http template it redirects to SSL, in SSL template there is a if statement to detect the www. Simply download, extract and place the files into
Code: Select all
/usr/local/vesta/data/templates/web/nginx/php-fpm
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
right, I didn't see that package in the list after installing following the instructions here: https://vestacp.com/docs/#how-to-force-httpsNinetou wrote: ↑Tue Apr 11, 2017 7:21 pmI'm running VestaCP on nginx + php-fpm stack (no Apache) and want to force SSL connections for my domains but it doesn't seem like Vesta is prepared to handle this kind of configuration.
I tried forcing it as documented in docs http://vestacp.com/docs/#how-to-force-https but force-https template works only if you use Apache with Nginx as proxy server.
On nginx + php-fpm stack Vesta looks for php-fpm templates inbut there's many of them so every single one would require something like:Code: Select all
/usr/local/vesta/data/templates/web/nginx/php-fpm
Is there a more centralised way of doing it?Code: Select all
server { listen 80; server_name mysite.com; return 301 https://$server_name$request_uri; }
I guess putting the two files under the php-fpm may work, but it didn't.
Will VestaCP team release another detailed and updated version of instruction?
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
The goal is to have LetsEncrypt working with both force SSL when using nginx + php-fpm. You need to duplicate or modify existing template and add the force SSL instruction inside of the "location / {" default nginx directive. I've responded to another thread and created a little instruction here: viewtopic.php?f=11&t=14269#p67578
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
It is not working for me to force without www.cybersholt wrote: ↑Fri Jan 26, 2018 6:40 pmHello,
I was looking for the exact same thing, in the docs it is only noted for apache installs. So I duplicated the default template files, in the http template it redirects to SSL, in SSL template there is a if statement to detect the www. Simply download, extract and place the files intoFiles are available at GitHub https://github.com/cybersholt/VestaCP-Nginx-Force-SSLCode: Select all
/usr/local/vesta/data/templates/web/nginx/php-fpm