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 currently running a LEMP stack for my WordPress project. The domain I am using serves over HTTPS+WWW (https://www.example.com), which means all of the following requests are redirected to it:
Right now, all of these requests are being redirected to HTTPS+WWW as part of the redirect rules created by certbot during the setup. Below is my current server configuration.
server {
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
client_max_body_size 64m;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
location ~* ^/xmlrpc.php$ {
return 403;
}
# WordPress: deny general stuff
location ~* ^/(?:xmlrpc\.php|wp-links-opml\.php|wp-config\.php|wp-config-sample\.php|wp-comments-post\.php$
deny all;
}
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.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
}
server {
if ($host = www.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name example.com www.example.com;
return 404; # managed by Certbot
expires $expires;
}
Generally, a user would input HTTP + NON-WWW requests in the browser (like just example.com). When I checked via Varvy Redirect Mapper, I could see that the HTTP + NON-WWW request has two redirects. Here is a screenshot.
https://i.imgur.com/BEE9RQo.png
I want to resolve all the requests in just a single redirect to HTTPS-WWW (https://www.example.com). I have tried a couple of logics and also looked over to several other examples online but couldn’t find a proper solution.
Could someone please help?
ebeecroft
68aa2215160846bca0a00f952c5fdc
009fd274aeae48f2bfbda6ef568676
Cloudstream Apk
032f50ee7f7d489db3b05e204fe139
032f50ee7f7d489db3b05e204fe139
Edward Sitarski
ebeecroft
dashan
34bcef38725b4e6eb5224ae028f17e