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.

I am trying to redirect https:// to https://www. Here is the block of code I am using:
server {
# root /home/user/www;
index index.html index.htm index.nginx-debian.html;
server_name ookma-kyi.tech www.ookma-kyi.tech;
location / {
root /home/user/www;
try_files $uri $uri/ =404;
}
location /demo {
root /home/user/app;
rewrite /demo/(.*) /$1 break;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/ookma-kyi.tech/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ookma-kyi.tech/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.ookma-kyi.tech) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = ookma-kyi.tech) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name ookma-kyi.tech www.ookma-kyi.tech;
return 404; # managed by Certbot
}
I tried adding a server block at the top with a 301 redirect like so:
server {
listen 443;
server_name ookma-kyi.tech
ssl_certificate /etc/letsencrypt/live/ookma-kyi.tech/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ookma-kyi.tech/privkey.pem; # managed by Certbot
return 301 https://www.ookma-kyi.tech$request_uri;
}
server {
# root /home/user/www;
index index.html index.htm index.nginx-debian.html;
server_name ookma-kyi.tech www.ookma-kyi.tech;
location / {
root /home/user/www;
try_files $uri $uri/ =404;
}
location /demo {
root /home/user/app;
rewrite /demo/(.*) /$1 break;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/ookma-kyi.tech/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ookma-kyi.tech/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.ookma-kyi.tech) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = ookma-kyi.tech) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name ookma-kyi.tech www.ookma-kyi.tech;
return 404; # managed by Certbot
}
All that did was show the Nginx welcome page. Any ideas?
Edward Sitarski
1fd6b9d2a2b94ee4b3e8ee6d5e2587
Traceurity
fadecomic
Mollie Semmes
Will Walters
f4df2e98b9c74f7eb7f6a0629cf1c4
erel
fingers
fingers