Jump to content

Recommended Posts

Posted

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*;
}

 

Captura de tela em 2017-02-05 13-49-57.png


Posted

Se o certificado foi validado e instalado corretamente, então o arquivo que "responde" pelo domínio e que dever ser editado é snginx.conf e não nginx.conf.

Se está usando Let's encrypt verifique se realmente ele está instalado corretamente, pois por padrão ele valida o domínio com e sem www. Obs. a integração nativa que foi implementada no Vesta costuma demorar um pouco para ficar 100% funcional o certificado.

Gerenciamento e otimização de servidores: Centos, Debian, Ubuntu, AlmaLinux, Cpanel e VestaCP.
Cloud otimizado e otimização para: Wordpress.
Virtualização: Implementação e gerenciamento Virtualizor, Proxmox, Openstack e VMware.

Posted
21 horas atrás, Andriopj disse:

Consegui resolver galera, obrigado.

Estava usando um certificado auto assinado mesmo?

Gerenciamento e otimização de servidores: Centos, Debian, Ubuntu, AlmaLinux, Cpanel e VestaCP.
Cloud otimizado e otimização para: Wordpress.
Virtualização: Implementação e gerenciamento Virtualizor, Proxmox, Openstack e VMware.

Posted
Em 06/02/2017 em 15:19, RevendaHost disse:

Estava usando um certificado auto assinado mesmo?

o certificado era apenas para o dominio sem www.
refiz o certificado, adicionei o www junto, e deu certo.

Posted
9 horas atrás, Andriopj disse:

o certificado era apenas para o dominio sem www.
refiz o certificado, adicionei o www junto, e deu certo.

A sim. Mas quando gerar o certificado não precisa colocar o www pois ele é automaticamente validado com e sem.

Gerenciamento e otimização de servidores: Centos, Debian, Ubuntu, AlmaLinux, Cpanel e VestaCP.
Cloud otimizado e otimização para: Wordpress.
Virtualização: Implementação e gerenciamento Virtualizor, Proxmox, Openstack e VMware.

Posted
Em 27/02/2017 em 01:56, Andriopj disse:

o certificado era apenas para o dominio sem www.
refiz o certificado, adicionei o www junto, e deu certo.

poderia passar o tutorial que seguiu? deste a criação do certificado a inclusão do mesmo?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Do you agree with our terms?