Force-HTTPS template isn't working on NGINX+PHP-FPM setup
-
- Posts: 5
- Joined: Sat Jan 07, 2017 1:57 pm
Force-HTTPS template isn't working on NGINX+PHP-FPM setup
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
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:
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!
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/
Code: Select all
/usr/local/vesta/data/templates/web/nginx/php-fpm/
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!
-
- Posts: 1
- Joined: Wed Jan 18, 2017 10:33 am
Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
Were you ever able to figure this out? I'm trying to do the same thing, but no luck so far. Thanks.
Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
try:
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
Code: Select all
nginx -t
/home/*/conf/web/nginx.conf
/home/*/conf/web/snginx.conf
/home/*/conf/web/nginx.*.conf_letsencrypt
Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
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:
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:
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.
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'
Code: Select all
listen 111.222.333.444:;
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.
Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
If you still cannot get the template to work, here is another solution:
Create a new file like so:
Add this code in:
Where USER and vestacp.com are - replace with real username and domain name.
Create a new file like so:
Code: Select all
/home/USER/conf/web/nginx.vestacp.com.conf
Code: Select all
if ($scheme = http) { return 301 https://vestacp.com$request_uri; }
Re: Force-HTTPS template isn't working on NGINX+PHP-FPM setup
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.SS88 wrote:If you still cannot get the template to work, here is another solution:
Create a new file like so:
Add this code in:Code: Select all
/home/USER/conf/web/nginx.vestacp.com.conf
Where USER and vestacp.com are - replace with real username and domain name.Code: Select all
if ($scheme = http) { return 301 https://vestacp.com$request_uri; }
Thank you!