Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Force SSL on Vesta without Apache (nginx + php-fpm)

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
7 posts • Page 1 of 1
Ninetou
Posts: 1
Joined: Tue Apr 11, 2017 6:16 pm

Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by Ninetou » Tue Apr 11, 2017 7:21 pm

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

Code: Select all

/usr/local/vesta/data/templates/web/nginx/php-fpm
but there's many of them so every single one would require something like:

Code: Select all

server {
    listen      80;
    server_name mysite.com;
    return 301 https://$server_name$request_uri;
}
Is there a more centralised way of doing it?
Top

vikhyat
Posts: 91
Joined: Wed Sep 14, 2016 5:39 pm

Re: Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by vikhyat » Tue Apr 25, 2017 11:46 am

Try forcing https using php. Check this tutorial on how to force https using php https://blog.flaunt7.com/force-https-php-htaccess/
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by skurudo » Tue Apr 25, 2017 3:56 pm

Ninetou wrote:Is there a more centralised way of doing it?
templates, I think
Top

cybersholt
Posts: 3
Joined: Fri Jan 26, 2018 6:33 pm
Contact:
Contact cybersholt
Website

Os: CentOS 6x
Web: nginx + php-fpm
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by cybersholt » Fri Jan 26, 2018 6:40 pm

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

Code: Select all

/usr/local/vesta/data/templates/web/nginx/php-fpm
Files are available at GitHub https://github.com/cybersholt/VestaCP-Nginx-Force-SSL
Top

baoang
Posts: 40
Joined: Fri Feb 23, 2018 7:31 am

Os: CentOS 5x
Web: nginx + php-fpm
Re: Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by baoang » Fri Feb 23, 2018 7:36 am

Ninetou wrote: ↑
Tue Apr 11, 2017 7:21 pm
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

Code: Select all

/usr/local/vesta/data/templates/web/nginx/php-fpm
but there's many of them so every single one would require something like:

Code: Select all

server {
    listen      80;
    server_name mysite.com;
    return 301 https://$server_name$request_uri;
}
Is there a more centralised way of doing it?
right, I didn't see that package in the list after installing following the instructions here: https://vestacp.com/docs/#how-to-force-https

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?
Top

noogen
Posts: 66
Joined: Thu Jan 05, 2017 9:20 pm

Re: Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by noogen » Tue Feb 27, 2018 6:31 pm

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
Top

zaqueon
Posts: 11
Joined: Thu Nov 06, 2014 9:24 am
Contact:
Contact zaqueon
Website

Re: Force SSL on Vesta without Apache (nginx + php-fpm)
  • Quote

Post by zaqueon » Mon Apr 23, 2018 2:05 pm

cybersholt wrote: ↑
Fri Jan 26, 2018 6:40 pm
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

Code: Select all

/usr/local/vesta/data/templates/web/nginx/php-fpm
Files are available at GitHub https://github.com/cybersholt/VestaCP-Nginx-Force-SSL
It is not working for me to force without www.
Top


Post Reply
  • Print view

7 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password