Nginx & certbot www not working (but https://www does)

I have this in /etc/nginx/sites-available/

server {

	root /var/www/html;
	index index.php index.html index.htm;

	# Make site accessible from http://localhost/

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ /index.php?$query_string;
		# Uncomment to enable naxsi on this location
		# include /etc/nginx/naxsi.rules

	error_page 404 /404.html;
	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
		root /usr/share/nginx/html;

	location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
	location /xxx {
        try_files $uri $uri/ =404;
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
	allow ip.x.x.x.x;
	deny all;
	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	location ~ /\.ht {
		deny all;

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # 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 = {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = {
        return 301 https://$host$request_uri;
    } # managed by Certbot

	listen 80 default_server;
	listen [::]:80 default_server ipv6only=on;
    return 404; # managed by Certbot


The redirects to (if I write in browser it goes to The works as well The is returning “This site can’t be reached”

In the DigitalOcean domains I have: CNAME is an alias of 43200 A directs to ipx.x.x.x 3600

What am I doing wrong why is not redirecting to

Also I cannot figure out how to redirect both, and to


Submit an 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.

Accepted Answer

Solved, http traffic was blocked by firewall. My mistake.