How can I point http://www.domain.com ,http://domain.com ,https://domain.com to https://www.domain.com

I want to http://www.mydomain.com ,http://mydomain.com ,https://mydomain.com point to ,How]https://www.mydomain.com,[/url]  How can I sent my Nginx.conf file?
You already invited:

Tomas

Upvotes from: admin

Here is my Nginx.conf
```
server {
listen 80;
server_name  xxx.com  www.xxx.com;
return 301 https://www.xxx.com$request_uri;
}
server {
listen 443 ssl http2;
server_name  xxx.com;

ssl on;
ssl_certificate fullchain.ecdsa-256.crt;
ssl_certificate_key privkey.ecdsa-256.key;

return 301 https://www.xxx.com$request_uri;
}
server {
listen 443 ssl http2;
server_name  www.xxx.com;
root /xxx/www;
index index.html;
...
}
```

Tony

Upvotes from: admin

Edit your nginx.conf and add codes into the http model
rewrite ^(.*) https://$host$1 permanent;
and,you have to ensure that you installed the ssl files in advance.

Erick

Upvotes from:

server {
listen 80;
server_name domain.com www.domain.com;
return 301 [url=https://www.domain.com]https://www.domain.com[/url]$request_uri;
}

server {
listen 443 ssl;
server_name xxx.com www.domain.com;
if ($http_host != 'www.domain.com' ) {
return 301 [url=https://www.domain.com]https://www.domain.com[/url]$request_uri;
}
}

jesse - Front end

Upvotes from:

Please see official docs:
 
http://nginx.org/en/docs/http/ ... .html

Ryan Haye

Upvotes from:

cloudflare page_rules is easy

Dana

Upvotes from:

80 port add : return 301 https://$server_name$request_uri;
below server_name add your whole domain name 

If you wanna answer this question please Login or Register