Welcome! Log In Create A New Profile

Advanced

How to have one vhost for www/non-www + http to https

Posted by ovidiu 
How to have one vhost for www/non-www + http to https
November 13, 2016 05:38PM
I'm looking to have one nginx host file which handles domain.tld and www.domain.tld with and without https and redirects all of them to use https and www so any visitor would end up at https www.domain.tld

I've tried various options and one of these 4 options was always incorrect.

My best lead so far is this advice I got: https://gist.github.com/bjornjohansen/b5a763a57a460edac47c8560502f6400 - does that look like hte best solution?
If it does could someone help me with what would go in the 2nd server block?

here is my real vhost config: http://pastebin.com/fYq2CjLf

any help is much appreciated, been struggling with this all day.
Re: How to have one vhost for www/non-www + http to https
November 17, 2016 12:45AM
I think you are using Wordpress source code. So, that is my configure: http://pastebin.com/0tdKz9MD
Re: How to have one vhost for www/non-www + http to https
November 17, 2016 04:46AM
Yes I do use Wordpress so if I understand your solution right, you don't care about www/non-www at nginx level you let Wordpress sort that out? You only make sure the site is called with HTTPS.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 146
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready