Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

Re: Require 'www' for https://example.com

$
0
0
On Mar 23, 2013, at 2:44 , openletter wrote:

> I am setting up a server that will be for a B2B business, and I want the
> whole site to be served as https://www.example.com/
>
> I have gotten a certificate and https://www.example.com runs just fine, but
> I can't figure out how to require https://www.example.com when a user tries
> to go to https://example.com.
>
> In reading through the nginx.org site, it seems like rewrites and if
> statements are discouraged. I did figure out how to require
> http://www.example.com/ by using the following in my server block file:
>
> server {
> listen [::]:80;
> server_name example.com *.example.com;
> return 301 $scheme://www.example.com$request_uri;
> }
>
> But doing something similar for 443 doesn't seem to work.
>
> Can someone please help me out or point to a good page on setting up for
> this?

You have to got a certificate also for "example.com" or certificate for two
names "www.example.com" and "example.com".


--
Igor Sysoev
http://nginx.com/services.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>