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.

Good day,
I am relatively new to this side of development and I am trying to setup domain redirection from, bar.com to foo.bar.com. I bought the domain from GoDaddy and pointed it back to Digital Ocean with NS records.
My DNS records for the site are as follows:
A *.bar.com
A foo.bar.com
NS bar.com ns1.digitalocean.com
NS bar.com ns2.digitalocean.com
NS bar.com ns3.digitalocean.com
In /etc/nginx/sites-available/bar:
# Redirect HTTP to HTTPS.
server {
listen 80;
listen [::]:80;
if ($host ~* ^.*bar.com$) {
return 301 https://foo.bar.com$request_uri;
}
server_name "~^.*bar.com$";
return 404;
}
# Redirect SSL domain to subdomain.
server {
server_name "^bar.com$";
return 301 https://foo.bar.com$request_uri;
listen [::]:443 ssl; # managed by Me
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/icare.invismi.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/icare.invismi.com/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
}
# Handle HTTPS.
server {
root /var/www/foo_bar/html;
index index.html index.htm index.nginx-debian.html;
client_max_body_size 20M;
server_name "~^.*bar.com$";
error_page 404 /index.html;
location / {
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/foo.bar.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/foo.bar.com/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
}
I expect the following to happen:
http://bar.com -> https://foo.bar.com
http://www.bar.com -> https://foo.bar.com
http://foo.bar.com -> https://foo.bar.com
http://www.foo.bar.com -> https://foo.bar.com
https://bar.com -> https://foo.bar.com
https://www.bar.com -> https://foo.bar.com
https://www.foo.bar.com -> https://foo.bar.com
But only these work:
https://foo.bar.com
http://www.bar.com -> https://foo.bar.com
This one displays the default Nginx page.
http://foo.bar.com
What do I need to change to make these redirects work? I’m not sure what to even look up and I’m not sure if my DNS A-records are the problem, or the sites-available config, or the Certbot SSL config.
Any help would be appreciated.
009fd274aeae48f2bfbda6ef568676
Cloudstream Apk
Ruz
Ruz
Edward Sitarski
ebeecroft
dashan
34bcef38725b4e6eb5224ae028f17e
markatango
gouskova
Andrew J Montanus