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-HTTPS template isn't working on NGINX+PHP-FPM setup

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
6 posts • Page 1 of 1
AnimusAstralis
Posts: 5
Joined: Sat Jan 07, 2017 1:57 pm

Force-HTTPS template isn't working on NGINX+PHP-FPM setup
  • Quote

Post by AnimusAstralis » Sat Jan 07, 2017 2:16 pm

Hello,

I made a clean custom install (NGINX+PHP-FPM) on a fresh droplet.

According to the instructions force-https template should be extracted to

Code: Select all

/usr/local/vesta/data/templates/web/nginx/
So I did it like I had done it before on default installations (and it worked). In this case I can't choose this template from dropdown menu because nginx templates are now located in:

Code: Select all

/usr/local/vesta/data/templates/web/nginx/php-fpm/
Simply moving template there doesn't work and moreover, nginx fails to restart after choosing this template.

I'm lost here (I'm neither total noob nor specialist). Either I need another template or maybe some proper instructions for installing force-https template on NGINX+PHP-FPM configuration.

I would be grateful for any help!
Top

gcwilliams
Posts: 1
Joined: Wed Jan 18, 2017 10:33 am

Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
  • Quote

Post by gcwilliams » Wed Jan 18, 2017 10:36 am

Were you ever able to figure this out? I'm trying to do the same thing, but no luck so far. Thanks.
Top

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

Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
  • Quote

Post by noogen » Sat Jan 21, 2017 2:22 am

try:

Code: Select all

nginx -t
What does it say? If you still can't figure out from error, can you post your conf files?
/home/*/conf/web/nginx.conf
/home/*/conf/web/snginx.conf
/home/*/conf/web/nginx.*.conf_letsencrypt
Top

wjp
Posts: 2
Joined: Sat Mar 11, 2017 10:36 am

Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
  • Quote

Post by wjp » Sat Mar 11, 2017 11:45 am

Hello
I have something to report concerning the issue raised by the op. in this post and finally I have a question.

I installed VestaCP a couple of days ago. My install uses nginx + php-fpm (no apache). Everything has been going fine except for trying to force sites to use https. In searching for answers I have found this current post. I found the same as the op. in that my installation looks in /usr/local/vesta/data/templates/web/nginx/php-fpm for templates. But having done a little digging I have something to add. Moving the two force-ssl templates to the php-fpm sub-folder location does work, in that the force-https option is now available to select in the control panel dropdown control. However, having selected the force-https option and updated the nginx config, nginx will not restart. Upon investigation, this is because (1) force-https.tpl contains a reference to a placeholder named proxy_port, and (2) force-https.stpl contains a reference to a place holder named proxy_ssl_port. Neither of these two place holders is referenced in my /usr/local/vesta/conf/vesta.conf, which contains these values:

Code: Select all

WEB_SYSTEM='nginx'
WEB_PORT='80'
WEB_SSL_PORT='443'
WEB_SSL='openssl'
WEB_BACKEND='php-fpm'
STATS_SYSTEM='webalizer,awstats'
MAIL_SYSTEM='exim4'
ANTIVIRUS_SYSTEM='clamav-daemon'
ANTISPAM_SYSTEM='spamassassin'
IMAP_SYSTEM='dovecot'
CRON_SYSTEM='cron'
FIREWALL_SYSTEM='iptables'
BACKUP_SYSTEM='local'
LANGUAGE='en'
VERSION='0.9.8'
DB_SYSTEM='mysql'
Consequently, when /home/admin/conf/web/nginx.conf and /home/admin/conf/web/nginx.conf are updated to reflect the changes, they contain lines like this:

Code: Select all

listen      111.222.333.444:;
Notice the missing port number, which causes nginx to be unable to restart successfully.

My immediate question is what should the values be for the two proxy placeholders? I don't properly understand how that is supposed to work. I can update the appropriate locations myself if know what values to use until such time as this is fixed properly by the developers.

Thanks for your help and for such a good open-source project.
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
  • Quote

Post by SS88 » Mon Mar 13, 2017 2:15 pm

If you still cannot get the template to work, here is another solution:

Create a new file like so:

Code: Select all

/home/USER/conf/web/nginx.vestacp.com.conf
Add this code in:

Code: Select all

if ($scheme = http) { return 301 https://vestacp.com$request_uri; }
Where USER and vestacp.com are - replace with real username and domain name.
Top

wjp
Posts: 2
Joined: Sat Mar 11, 2017 10:36 am

Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
  • Quote

Post by wjp » Tue Mar 14, 2017 7:17 pm

SS88 wrote:If you still cannot get the template to work, here is another solution:

Create a new file like so:

Code: Select all

/home/USER/conf/web/nginx.vestacp.com.conf
Add this code in:

Code: Select all

if ($scheme = http) { return 301 https://vestacp.com$request_uri; }
Where USER and vestacp.com are - replace with real username and domain name.
Grateful thanks to SS88 for this. This solution is beyond my current understanding of how nginx config works, but it provides a complete solution for my needs.

Thank you!
Top


Post Reply
  • Print view

6 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