Prezados,
Instalei o VestaCP (Nginx+PHP-FPM) em uma VPS que tenho, a principio está funcionando bem.
Nele subi o wordpress.
Acessei o VestaCP > WEB, e editei o dominio, adicionei o SSL Certificado/Key.
No wordpress, fui em configuração > Geral... e em "Endereço do WordPress (URL)" e "Endereço do site (URL)", alterei de HTTP://meudominio.com.br para HTTPS://meudominio.com.br
Perfeito...
Se digito no navegador o dominio sem WWW, como meudominio.com.br ele redireciona automaticamente para HTTPS://meudominio.com.br, acessando o site normalmente.
OU HTTPS://meudominio.com.br, também acessa o site normalmente.
Mas... se eu digito com WWW, não acessa o site, pois o certificado é valido apenas para o dominio sem WWW.
Em anexo o erro que aparece.
Tentei fazer alguns redirecionamento no nginx:
/home/usuario/conf/web/nginx.conf
sem sucesso.
Alguém poderia me dar uma ajuda de como eu resolvo isso?
Segue como está meu nginx.conf
server {
listen 201.73.169.52:80;
server_name criptoguia.com.br www.criptoguia.com.br;
root /home/user/web/criptoguia.com.br/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/criptoguia.com.br.log combined;
access_log /var/log/nginx/domains/criptoguia.com.br.bytes bytes;
error_log /var/log/nginx/domains/criptoguia.com.br.error.log error;
# Rocket-Nginx configuration
include rocket-nginx/rocket-nginx.conf;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Block PHP files in the includes directory
location ~* /wp-includes/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
# Block PHP files in the content directory
location ~* /wp-content/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
# No PHP scripts in the uploads directory
location ~* /(?:uploads|files)/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
location ~* /themes/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
location ~* /plugins/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
# Hide sensitive files
location ~* .(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(.php)?|xtmpl)$|^(..*|Entries.*|Repository|Root|Tag|Template)$|.php_
{
return 444;
}
# No other CGI scripts
location ~* .(pl|cgi|py|sh|lua)$ {
return 444;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
set $skip_cache 1;
}
location /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
# Rate limiting so that brute force is prevented
location = /wp-login.php {
limit_req zone=one burst=3 nodelay;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/user/web/criptoguia.com.br/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/user/web/criptoguia.com.br/stats/;
include /home/user/web/criptoguia.com.br/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/user/conf/web/nginx.criptoguia.com.br.conf*;
}