To redirect non-www to www you need to create a file (redirect.conf) in this folder /etc/nginx/conf.d
in this file you add
server {
server_name domain.com;
return 301 https://www.domain.com$request_uri;
}
From my side I'm trying to add a SSL certificate that I bought, but I didn't find where to add
server {
listen 443;
server_name example.com;
ssl on;
ssl_certificate /var/www/example.com/cert/example.com.crt;
ssl_certificate_key /var/www/example.com/cert/example.com.key;
#... other stuff
}
if you please can you send me the content of these files (don't forget to remove your domain)
/var/www/domain.com/conf/nginx/ssl.conf
/etc/nginx/conf.d/force-ssl-.conf
it may help me find a solution for my challenge!