Good evening, I don't know why it doesn't redirect me to https: When I put the .es or the .com without the https:// I get the nginx page.
server {
listen 80;
server_name dominio.com www.dominio.com dominio.es www.dominio.es
return 301 https://dominio.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443;
server_name dominio.com; # Aquí va sin www
ssl on;
ssl_certificate /etc/letsencrypt/live/dominio.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dominio.com/privkey.pem;
root /var/www/pizzaConstruccion/;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}