Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Using a https error code 497, it is possible to do it in two server blocks.
This is tested and working on my site.
server {
listen 80;
server_name www.domain.com domain.com;
# redirects both www and non-www to ssl port with http (NOT HTTPS, forcing error 497)
return 301 http://domain.com$request_uri;
}
server {
listen 433 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name domain.com;
error_page 497 https://domain.com$request_uri;
include snippets/ssl-domain.com.conf;
include snippets/ssl-params.conf;
# other vhost configuration
}
Hope this helps!
This comment has been deleted