We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
http (www or non-www) to https non-www on VPS Debian 9 server for all sites
http (www or non-www) to https non-www on VPS Debian 9 server for all sites
I just set up a VPS server from Hostwinds running Debian 9 and Vesta. Have spent days trying to make sure all sites with SSL certificates load this way:
https://anydomain.com
Since I have more than 50 sites on the server and trying to test on the .htaccess file in each domain's public_html folder is a pain in the neck and I also get the "too many redirects" error. I wonder if there is a better and easy way.
I have tried with this one:
https://www.digitalocean.com/community/ ... ntu-14-04/
but that is for apache server, not for the nginx server. So after implementing that by adding the following
I found this
https://www.digitalocean.com/community/ ... n-on-nginx
And everestmx replied this on August 9, 2014:
https://anydomain.com
Since I have more than 50 sites on the server and trying to test on the .htaccess file in each domain's public_html folder is a pain in the neck and I also get the "too many redirects" error. I wonder if there is a better and easy way.
I have tried with this one:
https://www.digitalocean.com/community/ ... ntu-14-04/
but that is for apache server, not for the nginx server. So after implementing that by adding the following
in the .htaccess file in the /var/www/html folder, I got this after typing this command # curl -I http://www.hanzicode.comRewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
So it works in stripping off www in URL, but not in redirecting to httpsHTTP/1.1 302 Found
Server: nginx
Date: Tue, 07 May 2019 22:03:30 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 205
Connection: keep-alive
Keep-Alive: timeout=60
Location: http://hanzicode.com/
I found this
https://www.digitalocean.com/community/ ... n-on-nginx
And everestmx replied this on August 9, 2014:
This seems to be the global solution for all sites, but which file I should put this code in?# host_without_www
if ( $host ~* ^www\.(?<nowww>.*)$ ) {
rewrite .* $scheme://$nowww$request_uri permanent;
}
# host_with_www
if ( $host ~* ^(?!www\.) ) {
rewrite .* $scheme://www.$host$request_uri permanent;
}
Last edited by lotnomore on Wed May 08, 2019 12:43 am, edited 1 time in total.
Re: http (www or non-www) to https non-www on VPS Debian 9 server for all sites
Try this one
Code: Select all
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Re: http (www or non-www) to https non-www on VPS Debian 9 server for all sites
Tried that. No luck, the same response for commandkenneth wrote: ↑Tue May 07, 2019 11:06 pmTry this oneCode: Select all
RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Code: Select all
curl -I http://www.hanzicode.com
HTTP/1.1 302 Found
Server: nginx
Date: Tue, 07 May 2019 23:27:46 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 205
Connection: keep-alive
Keep-Alive: timeout=60
Location: http://hanzicode.com/