<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Arquivos nginx - Remontti</title>
	<atom:link href="https://blog.remontti.com.br/tag/nginx/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.remontti.com.br/tag/nginx</link>
	<description>rudimar@remontti</description>
	<lastBuildDate>Fri, 23 Aug 2024 13:04:58 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.remontti.com.br/wp-content/uploads/2024/09/icone-rr-80x80.png</url>
	<title>Arquivos nginx - Remontti</title>
	<link>https://blog.remontti.com.br/tag/nginx</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Guia completo para instalar e configurar Zabbix 7 LTS no Debian 12 Bookworm com NGINX e PostgreSQL</title>
		<link>https://blog.remontti.com.br/7870</link>
					<comments>https://blog.remontti.com.br/7870#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Tue, 09 Apr 2024 18:05:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administração de Sistemas]]></category>
		<category><![CDATA[configuração do NGINX]]></category>
		<category><![CDATA[configuração do Zabbix]]></category>
		<category><![CDATA[Debian 12 Bookworm]]></category>
		<category><![CDATA[gerenciamento de serviços de TI]]></category>
		<category><![CDATA[instalação do Zabbix]]></category>
		<category><![CDATA[monitoramento de rede]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[otimização do BASH]]></category>
		<category><![CDATA[performance do PostgreSQL]]></category>
		<category><![CDATA[PHP 8]]></category>
		<category><![CDATA[PHP para Zabbix]]></category>
		<category><![CDATA[planejamento de capacidade]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[relatórios de monitoramento]]></category>
		<category><![CDATA[segurança em servidores]]></category>
		<category><![CDATA[visualização de dados]]></category>
		<category><![CDATA[zabbix]]></category>
		<category><![CDATA[Zabbix 7 LTS]]></category>
		<category><![CDATA[Zabbix no Debian]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=7870</guid>

					<description><![CDATA[<p>O Zabbix é uma solução de nível empresarial e de código aberto. Ele monitora diversos parâmetros de rede, servidores e a saúde dos serviços, utilizando um mecanismo flexível de notificação. Este mecanismo permite configurar&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/7870">Guia completo para instalar e configurar Zabbix 7 LTS no Debian 12 Bookworm com NGINX e PostgreSQL</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-capa.png" alt="" width="1792" height="1024" class="alignnone size-full wp-image-7890" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-capa.png 1792w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-capa-300x171.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-capa-1024x585.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-capa-768x439.png 768w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-capa-1536x878.png 1536w" sizes="(max-width: 1792px) 100vw, 1792px" /></p>
<p>O <strong>Zabbix</strong> é uma solução de nível empresarial e de código aberto. Ele monitora diversos parâmetros de rede, servidores e a saúde dos serviços, utilizando um mecanismo flexível de notificação. Este mecanismo permite configurar alertas, por e-mail e outros meios como Telegram, para quase qualquer evento, facilitando uma rápida resposta a problemas. Além disso, o Zabbix oferece recursos avançados para relatórios e visualização de dados armazenados, sendo ideal para o planejamento de capacidade.</p>
<h3>Requisitos Debian 12 Bookworm </h3>
<p>&#8211; <a href="https://blog.remontti.com.br/7236" rel="noopener" target="_blank">Instalação do Debian 12 Bookworm limpa passo-a-passo</a></p>
<h3>Melhorando o seu BASH</h3>
<p>Para melhorar seu bash e entender o comando a seguir, visite: <a href="https://blog.remontti.com.br/5867" rel="noopener" target="_blank">Como melhorar a produtividade no seu Debian após a instalação</a></p>
<pre class="remontti-code"># apt -y install wget; wget remontti.com.br/debian; bash debian; su -</pre>
<h3>Instalação do NGINX</h3>
<p>Procederemos com a instalação do <a href="https://www.nginx.com" rel="noopener" target="_blank">nginx</a>, ocultando a sua versão como uma boa prática.</p>
<pre class="remontti-code"># apt -y install nginx
# sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<h3>Instalação PHP 8</h3>
<p>Vamos instalar extensões do PHP usadas pelo Zabbix e evitar a instalação de pacotes recomendados <em>(&#8211;no-install-recommends)</em> para que o Apache não seja instalado.</p>
<pre class="remontti-code">#  apt -y install --no-install-recommends \
 php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}</pre>
<p>Aumentar o limite de tempo de execução e o tamanho máximo de upload no PHP.</p>
<pre class="remontti-code"># vim /etc/php/8.2/fpm/php.ini</pre>
<p>Localize <strong>max_execution_time</strong> e altere para 600 e upload_max_filesize para 100MB</p>
<pre class="remontti-code">max_execution_time = 600
upload_max_filesize = 100M</pre>
<p>Reinicie o serviço do PHP.</p>
<pre class="remontti-code"># systemctl restart php8.2-fpm</pre>
<h3>Instalação do PostgreSQL</h3>
<p>Instalação dos pacotes necessários do PostgreSQL.</p>
<pre class="remontti-code"># apt -y install postgresql postgresql-contrib</pre>
<p>Altere para o usuário postgres.</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Acesse o terminal de comandos do banco de dados.</p>
<pre class="remontti-code">$ psql</pre>
<p>Para definir a senha do usuário postgres e instalar o adminpack.</p>
<pre class="remontti-code">postgres=# \password postgres
Digite nova senha para postgres: 
Digite-a novamente:
postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION
postgres=# \q 
$ exit</pre>
<p>Realize ajustes no arquivo pg_hba.conf para autenticação com senha.</p>
<pre class="remontti-code"># sed -i &#039;/postgres.*peer/s/peer/md5/&#039; /etc/postgresql/15/main/pg_hba.conf
# sed -i &#039;0,/local\s*all\s*all\s*peer/s/peer/md5/&#039; /etc/postgresql/15/main/pg_hba.conf</pre>
<p>É recomendado ajustar as configurações padrões do PostgreSQL conforme a memória disponível.</p>
<pre class="remontti-code">vim /etc/postgresql/15/main/postgresql.conf</pre>
<pre class="remontti-code">#-----------------------------------------
# 4GB de Memoria RAM
#-----------------------------------------
max_connections = 500
shared_buffers = 1GB
work_mem = 16MB
maintenance_work_mem = 128MB
max_wal_size = 1GB
min_wal_size = 256MB
effective_cache_size = 2GB

#-----------------------------------------
# 8GB de Memoria RAM
#-----------------------------------------
max_connections = 1000
shared_buffers = 2GB
work_mem = 32MB
maintenance_work_mem = 512MB
max_wal_size = 2GB
min_wal_size = 512MB
effective_cache_size = 4GB

#-----------------------------------------
# 16GB de Memoria RAM
#-----------------------------------------
max_connections = 2000
shared_buffers = 4GB
work_mem = 64MB
maintenance_work_mem = 1GB
max_wal_size = 4GB
min_wal_size = 1GB
effective_cache_size = 8GB</pre>
<p>Reinicie o serviço do PostgreSQL.</p>
<pre class="remontti-code"># systemctl  restart postgresql</pre>
<h1>Instalação do Zabbix 7 LTS</h1>
<p>Inclua o repositório oficial do Zabbix versão 7 LTS.</p>
<pre class="remontti-code"># cd /tmp/
# wget https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb
# dpkg -i zabbix-release_7.0-1+debian12_all.deb
# apt update</pre>
<pre class="remontti-code"># apt -y install zabbix-server-pgsql zabbix-frontend-php \
  zabbix-nginx-conf zabbix-sql-scripts zabbix-agent traceroute</pre>
<p>Crie uma base de dados chamada <strong>zabbix</strong> e um usuário também chamado <strong>zabbix</strong> no PostgreSQL. Lembre-se de alterar a senha. Use o gerador de senha: <a href="https://senhasegura.remontti.com.br/" rel="noopener noreferrer" target="_blank">https://senhasegura.remontti.com.br/</a></p>
<pre class="remontti-code"># su - postgres
$ createuser --pwprompt zabbix
Digite a senha para a nova role:  &lt;SENHA ZABBIX&gt;
Digite-a novamente: &lt;SENHA ZABBIX&gt;
Senha: &lt;SENHA POSTGRES CASO TENHA DEFINIDO NA INSTALAÇÃO DO MESMO&gt;

$ createdb -O zabbix zabbix
Senha: &lt;SENHA POSTGRES&gt;</pre>
<p>Importe o esquema inicial e os dados. Você será solicitado a inserir a senha que foi criada anteriormente.</p>
<pre class="remontti-code">$ zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | psql -U zabbix -d zabbix &amp;&gt;/dev/null
Senha para usuário zabbix: : &lt;SENHA ZABBIX&gt;
$ exit</pre>
<p>Configure o arquivo zabbix_server.conf para conectar ao banco de dados PostgreSQL.</p>
<pre class="remontti-code"># vim /etc/zabbix/zabbix_server.conf</pre>
<p>Descomente e defina a senha na linha <strong># DBPassword=</strong>.</p>
<pre class="remontti-code">#...
DBPassword=&lt;SENHA ZABBIX&gt;
#...</pre>
<p>Ajuste o arquivo /etc/zabbix/php-fpm.conf, descomente e defina o fuso horário correto. <a href="https://secure.php.net/manual/pt_BR/timezones.america.php" rel="noopener noreferrer" target="_blank">timezone</a> Sua região</a>.</p>
<pre class="remontti-code"># vim /etc/zabbix/php-fpm.conf</pre>
<p>Adicione timezone, e ajuste upload_max_filesize:</p>
<pre class="remontti-code-plain">php_value[date.timezone] = America/Sao_Paulo
php_value[upload_max_filesize] = 100M</pre>
<p>Configure as definições do nginx.</p>
<pre class="remontti-code"># vim /etc/nginx/conf.d/zabbix.conf </pre>
<p>Deixei algumas linhas comentadas como exemplo, faça de acordo com sua necessidade.</p>
<pre class="remontti-code">server {
        listen 80;
        listen [::]:80;
        server_name    zabbix.remontti.com.br localhost;
        #server_name   OU_SEU_IP;

        # Metodo simples para quem quer rodar em uma determinada porta
        #listen 8181;
        #listen [::]:8181;
        #server_name     _;

        root    /usr/share/zabbix;
        index   index.php;

        # Desmomente para deixar restringido apenas para determinados prefixos
        #allow  192.168.87.0/24;
        #allow  127.0.0.1;
        #allow  2001:0db8::/32;
        #allow  ::1;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;

        client_max_body_size 100M;
 
        location = /favicon.ico {
                log_not_found   off;
        }

        location / {
                try_files       $uri $uri/ =404;
        }

        location /assets {
                access_log      off;
                expires         10d;
        }

        location ~ /\.ht {
                deny            all;
        }

        location ~ /(api\/|conf[^\.]|include|locale) {
                deny            all;
                return          404;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_pass    unix:/var/run/php/zabbix.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index   index.php;

                fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
                fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
                fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

                include fastcgi_params;
                fastcgi_param   QUERY_STRING    $query_string;
                fastcgi_param   REQUEST_METHOD  $request_method;
                fastcgi_param   CONTENT_TYPE    $content_type;
                fastcgi_param   CONTENT_LENGTH  $content_length;

                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout         60;
                fastcgi_send_timeout            180;
                fastcgi_read_timeout            180;
                fastcgi_buffer_size             128k;
                fastcgi_buffers                 4 256k;
                fastcgi_busy_buffers_size       256k;
                fastcgi_temp_file_write_size    256k;
        }
}
</pre>
<p>Habilite o Zabbix para iniciar com o sistema.</p>
<pre class="remontti-code"># systemctl enable zabbix-server</pre>
<p>Vamos reiniciar os serviços</p>
<pre class="remontti-code"># systemctl restart zabbix-server zabbix-agent nginx</pre>
<p>Acesse <strong>http://seu_ip:porta</strong> ou <strong>http://zabbix.seudominio.com.br</strong> no navegador.</p>
<p>Siga as instruções de configuração na interface web do Zabbix.</p>
<p><strong>Selecione o idioma, e Próximo passo</strong><br />
<img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-1.png" alt="" width="1268" height="702" class="alignnone size-full wp-image-7878" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-1.png 1268w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-1-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-1-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-1-768x425.png 768w" sizes="(max-width: 1268px) 100vw, 1268px" /></p>
<p>Se tudo estiver ok: <strong>Próximo passo</strong><br />
<img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-2.png" alt="" width="1268" height="1243" class="alignnone size-full wp-image-7879" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-2.png 1268w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-2-300x294.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-2-1024x1004.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-2-768x753.png 768w" sizes="(max-width: 1268px) 100vw, 1268px" /></p>
<p>Selecione <strong>PostgreSQL</strong> e informe a <strong>senha do usuário zabbix </strong>criada anteriormente, clique em <strong>Próximo passo</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-3.png" alt="" width="1275" height="739" class="alignnone size-full wp-image-7880" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-3.png 1275w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-3-300x174.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-3-1024x594.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-3-768x445.png 768w" sizes="auto, (max-width: 1275px) 100vw, 1275px" /></p>
<p><strong>Defina um nome, e selecione o Tema padrão e clique em Próximo passo</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-4.png" alt="" width="1268" height="702" class="alignnone size-full wp-image-7881" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-4.png 1268w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-4-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-4-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-4-768x425.png 768w" sizes="auto, (max-width: 1268px) 100vw, 1268px" /></p>
<p><strong>Se tudo estiver ok, Próximo passo</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-5.png" alt="" width="1268" height="702" class="alignnone size-full wp-image-7882" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-5.png 1268w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-5-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-5-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-5-768x425.png 768w" sizes="auto, (max-width: 1268px) 100vw, 1268px" /></p>
<p><strong>Fim</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-6.png" alt="" width="1268" height="702" class="alignnone size-full wp-image-7883" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-6.png 1268w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-6-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-6-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-6-768x425.png 768w" sizes="auto, (max-width: 1268px) 100vw, 1268px" /></p>
<p>Entre com Usuário <strong>Admin</strong> e senha <strong>zabbix</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-7.png" alt="" width="1268" height="702" class="alignnone size-full wp-image-7884" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-7.png 1268w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-7-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-7-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-7-768x425.png 768w" sizes="auto, (max-width: 1268px) 100vw, 1268px" /></p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-8-inicial.png" alt="" width="1967" height="937" class="alignnone size-full wp-image-7885" srcset="https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-8-inicial.png 1967w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-8-inicial-300x143.png 300w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-8-inicial-1024x488.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-8-inicial-768x366.png 768w, https://blog.remontti.com.br/wp-content/uploads/2024/04/zabbix-7-debian-12-8-inicial-1536x732.png 1536w" sizes="auto, (max-width: 1967px) 100vw, 1967px" /></p>
<p>Simples né? Gostou e quer me ajudar? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p>Fontes:<br />
<a href="https://www.zabbix.com/documentation/7.0/" rel="noopener" target="_blank">https://www.zabbix.com/documentation/</a></p>
<p>O post <a href="https://blog.remontti.com.br/7870">Guia completo para instalar e configurar Zabbix 7 LTS no Debian 12 Bookworm com NGINX e PostgreSQL</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/7870/feed</wfw:commentRss>
			<slash:comments>30</slash:comments>
		
		
			</item>
		<item>
		<title>Guia Passo a Passo para Instalar o Typebot em seu servidor próprio</title>
		<link>https://blog.remontti.com.br/7656</link>
					<comments>https://blog.remontti.com.br/7656#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Fri, 22 Sep 2023 15:32:29 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[automação]]></category>
		<category><![CDATA[banco de dados]]></category>
		<category><![CDATA[bookworm]]></category>
		<category><![CDATA[Certbot]]></category>
		<category><![CDATA[Chatbot]]></category>
		<category><![CDATA[Configuração]]></category>
		<category><![CDATA[Debian 12]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[instalaçao]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[passo a passo]]></category>
		<category><![CDATA[PM2]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[Prisma]]></category>
		<category><![CDATA[Segurança]]></category>
		<category><![CDATA[Servidor]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Typebot]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=7656</guid>

					<description><![CDATA[<p>O Typebot é uma ferramenta de código aberto que permite criar aplicativos ou formulários conversacionais de forma simples e eficaz. Ele oferece uma alternativa robusta a outras plataformas como o Landbot. Com o Typebot,&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/7656">Guia Passo a Passo para Instalar o Typebot em seu servidor próprio</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot.jpeg" alt="" width="1024" height="640" class="alignnone size-full wp-image-7666" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot.jpeg 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-300x188.jpeg 300w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-768x480.jpeg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></p>
<p>O <a href="https://typebot.io" rel="noopener" target="_blank"><strong>Typebot</strong></a> é uma ferramenta de código aberto que permite criar aplicativos ou formulários conversacionais de forma simples e eficaz. Ele oferece uma alternativa robusta a outras plataformas como o Landbot. Com o Typebot, você pode criar diferentes tipos de aplicativos conversacionais, como:</p>
<p>&#8211; Qualificação de leads<br />
&#8211; Lançamento de produtos<br />
&#8211; Integração de usuários<br />
&#8211; Suporte ao cliente</p>
<p>O Typebot é amado por equipes e criadores em todo o mundo e oferece uma experiência de construção fácil. Você pode arrastar e soltar blocos para criar seu aplicativo e integrá-lo facilmente em qualquer plataforma. Além disso, ele permite coletar resultados em tempo real, o que é uma grande vantagem.</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-scaled.webp" alt="" width="2560" height="1465" class="alignnone size-full wp-image-7664" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-scaled.webp 2560w, https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-300x172.webp 300w, https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-1024x586.webp 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-768x439.webp 768w, https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-1536x879.webp 1536w, https://blog.remontti.com.br/wp-content/uploads/2023/09/builder-screenshot-2048x1172.webp 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></p>
<h4>Exemplos de Uso</h4>
<p><strong>&#8211; Coleta de Informações de Contato:</strong> Substitua seus formulários tradicionais por um chatbot que pode coletar nomes, e-mails e outros detalhes de forma interativa.<br />
<strong>&#8211; Suporte ao Cliente:</strong> Use o Typebot para responder automaticamente a perguntas frequentes e fornecer suporte em tempo real.<br />
<strong>&#8211; Integração de Usuários:</strong> Facilite o processo de integração, fornecendo aos novos usuários um guia passo a passo interativo.<br />
&#8211; Campanhas de Marketing: Utilize o Typebot em suas landing pages para aumentar as taxas de conversão e engajamento.<br />
<strong>&#8211; Pesquisas e Feedback:</strong> Colete feedback do usuário ou conduza pesquisas de forma mais envolvente e interativa.</p>
<h4>Requesitos</h4>
<p><a href="https://blog.remontti.com.br/7236" rel="noopener" target="_blank">Debian 12 bookworm (Instalação Limpa)</a></p>
<h4>DNS</h4>
<p>Crie duas entradas em seu DNS exemplo:<br />
&#8211; typebot.remontti.cum.br apontando para os IPs do servidor<br />
&#8211; typebotapi.remontti.cum.br apontando para os IPs do servidor</p>
<p>Se você<a href="https://blog.remontti.com.br/5958" rel="noopener" target="_blank"> já é da turma do blog</a> vai entender o que temos a baixo la no amigo bind9:</p>
<pre class="remontti-code-plain">typebot       A       192.168.0.100
              AAAA    2001:db8:bebe:cafe::100

typebotapi    A       192.168.0.100
              AAAA    2001:db8:bebe:cafe::100</pre>
<h4>Atualização e Instalação de Pacotes</h4>
<pre class="remontti-code"># apt update; apt upgrade -y</pre>
<p>Instale os pacotes necessários para o projeto</p>
<pre class="remontti-code"># apt install -y nodejs npm git nginx postgresql postgresql-contrib</pre>
<p>Instala globalmente os pacotes pm2 e pnpm usando npm</p>
<pre class="remontti-code"># npm install -g pm2 pnpm</pre>
<h4>Configuração do PostgreSQL</h4>
<p>Alterne para o usuário postgres</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Crie um novo usuário chamado &#8216;typebot&#8217; em seguida inserira uma senha.</p>
<pre class="remontti-code">$ createuser --pwprompt typebot</pre>
<p>Crie um novo banco de dados &#8216;typebot&#8217; e define &#8216;typebot&#8217; como o proprietário</p>
<pre class="remontti-code">$ createdb -O typebot typebot</pre>
<p>Sai do usuário postgres</p>
<pre class="remontti-code">$ exit</pre>
<h4>Preparando formas de autenticação</h4>
<p>Vou deixar 3 formas que são as mais fáceis, você pode optar em usar apenas uma.</p>
<h4>Email</h4>
<p>A mais fácil de todas, basta você utilizar um email, assim toda vez que você for logar ele ira lhe mandar um e-mail com o link. </p>
<h4>Google</h4>
<p>Crie um novo projeto em <a href="https://console.developers.google.com/apis/credentials" rel="noopener" target="_blank">https://console.developers.google.com/apis/credentials</a></p>
<pre class="remontti-code-plain">
Cria um novo projeto
&gt; OAuth consent screen
	&gt; externo 
	Nome: Typebot
	User support email: seu!
	Developer contact information: seu!
	 SAVE

	 ADD OR REMOVE SCOPES
	   	.../auth/userinfo.email
	   	.../auth/userinfo.profile
	   	 SAVE

	   	 SAVE

	   	 BACK TO DASH
&gt; Credentials 
	+ CREATE CREDENTALS
	  &gt; Create OAuth client ID 
		Application type: Web application
		Name: Typebot

		Authorized redirect URIs
		https://typebot.remontti.cum.br/api/auth/callback/google

	Client ID
	Anote

	Client secret
	Anote</pre>
<p>Será usado em:</p>
<pre class="remontti-code-plain">GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=</pre>
<h4>Github</h4>
<p>Acesse <a href="https://github.com/settings/developers" rel="noopener" target="_blank">https://github.com/settings/developers</a> e clique em <strong>New OAuth Apps</strong></p>
<pre class="remontti-code-plain">Application name: Typebot
Homepage URL: https://typebot.remontti.cum.br
Application description: Typebot Auth
Authorization callback URL: https://typebot.remontti.cum.br/api/auth/callback/github</pre>
<p>Anote o <strong>Client ID</strong> e clique em <strong>Generate a new client secret</strong> anote os dois para ser usado em </p>
<pre class="remontti-code-plain">GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=</pre>
<h4>Configuração do Projeto Typebot no Servidor</h4>
<p>Vamos armazenar o projeto mo diretório /opt. </p>
<pre class="remontti-code"># cd /opt/
# git clone https://github.com/baptisteArno/typebot.io.git</pre>
<p>Entre no diretório do projeto<br />
cd typebot.io</p>
<p>Crie arquivo <strong>.env</strong> onde irá ficar as <a href="https://docs.typebot.io/self-hosting/configuration" rel="noopener" target="_blank">variáveis de ambiente</a>.</p>
<pre class="remontti-code"># vim /opt/typebot.io/.env</pre>
<p>Faça os ajustes:</p>
<pre class="remontti-code-plain"># Define a chave de criptografia (Gere aqui https://senhasegura.remontti.cum.br/)
ENCRYPTION_SECRET=i9eRecwVJQeKENqdcrQeizOXFHzQdwAp

# Define a URL de conexão com o banco de dados PostgreSQL
DATABASE_URL=postgresql://typebot:minhasupersenha@localhost:5432/typebot

# Define as URLs para autenticação e API
NEXTAUTH_URL=https://typebot.remontti.cum.br
NEXT_PUBLIC_VIEWER_URL=https://typebotapi.remontti.cum.br

# Define o e-mail do administrador
ADMIN_EMAIL=typebot@remontti.cum.br

# Define as configurações para o servidor SMTP
SMTP_USERNAME=typebot@remontti.cum.br
SMTP_PASSWORD=minhasenha
SMTP_HOST=mail.remontti.cum.br
SMTP_PORT=25
NEXT_PUBLIC_SMTP_FROM=typebot@remontti.cum.br
SMTP_SECURE=false
SMTP_AUTH_DISABLED=false

# Configurações para autenticação via Google e GitHub (opcional)
# Google
GOOGLE_CLIENT_ID=98916e5d5dd1-e3lfmixxuditlz2egexp0n8bfwf3oie3.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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

# GitHub
GITHUB_CLIENT_ID=6ewyvfeumndg2ve5kve1
GITHUB_CLIENT_SECRET=7r78f2vpmihgriebkp7p4b0ervd4qc7ufu1uu5nx

# Permite ou desabilita o cadastro de novas contas
DISABLE_SIGNUP=false</pre>
<p>Instale todas as dependências do projeto</p>
<pre class="remontti-code"># cd /opt/typebot.io/
# pnpm install</pre>
<p>Saída:</p>
<pre class="remontti-code-plain">Scope: all 19 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +2398
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Downloading registry.npmjs.org/next/13.4.3: 12,32 MB/12,32 MB, done
[...]
[...]
[...]
devDependencies:
+ cross-env 7.0.3
+ cz-emoji 1.3.2-canary.2
+ husky 8.0.3
+ prettier 2.8.8
+ turbo 1.10.12

. prepare$ husky install
│ husky - Git hooks installed
└─ Done in 288ms
Done in 2m 12.5s</pre>
<p>Compile os aplicativos</p>
<pre class="remontti-code"># cd /opt/typebot.io/
# pnpm run build:apps</pre>
<p>Saída</p>
<pre class="remontti-code-plain">&gt; typebot-os@2.17.2 build:apps /root/typebot.io
&gt; turbo run build --filter=builder... --filter=viewer...
[...]
[...]
[...]
[...]
builder:build: ○  (Static)  automatically rendered as static HTML (uses no initial props)
builder:build: 

 Tasks:    9 successful, 9 total
Cached:    0 cached, 9 total
  Time:    5m28.928s 

⠋ ...writing to cache...  [1s] 

─────────┴──────────┴──────────┘</pre>
<p>Copie o arquivo .env para os diretórios dos aplicativos</p>
<pre class="remontti-code"># cp /opt/typebot.io/.env /opt/typebot.io/apps/builder/
# cp /opt/typebot.io/.env /opt/typebot.io/apps/viewer/</pre>
<p>Configuração e migrações do banco de dados</p>
<pre class="remontti-code"># cd /opt/typebot.io/
# pnpm prisma generate &amp;&amp; pnpm db:migrate</pre>
<p>Saída:</p>
<pre class="remontti-code-plain">Environment variables loaded from .env
prisma:warn We could not find your Prisma schema at `prisma/schema.prisma`.
If you have a Prisma schema file in a custom path, you will need to run
`prisma generate --schema=./path/to/your/schema.prisma` to generate Prisma Client.
If you do not have a Prisma schema file yet, you can ignore this message.


&gt; typebot-os@2.17.2 db:migrate /opt/typebot.io
&gt; cd packages/prisma &amp;&amp; pnpm run db:migrate


&gt; @typebot.io/prisma@0.1.0 db:migrate /opt/typebot.io/packages/prisma
&gt; pnpm migrate:deploy


&gt; @typebot.io/prisma@0.1.0 migrate:deploy /opt/typebot.io/packages/prisma
&gt; dotenv -e ./.env -e ../../.env -- tsx scripts/migrate-deploy.ts

Executing for PostgreSQL schema
┌─────────────────────────────────────────────────────────┐
│  Update available 5.0.0 -&gt; 5.3.1                        │
│  Run the following to update                            │
│    npm i --save-dev prisma@latest                       │
│    npm i @prisma/client@latest                          │
└─────────────────────────────────────────────────────────┘</pre>
<p>Inicia os aplicativos com o PM2</p>
<pre class="remontti-code"># pm2 start --name=typebotwww --cwd /opt/typebot.io/apps/builder/ &quot;pnpm -- next start -p 54001&quot;
# pm2 start --name=typebotapi --cwd /opt/typebot.io/apps/viewer/ &quot;pnpm -- next start -p 54002&quot;</pre>
<pre class="remontti-code-plain">┌────┬───────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name          │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼───────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1  │ typebotapi    │ default     │ N/A     │ fork    │ 819      │ 0s     │ 0    │ online    │ 0%       │ 10.8mb   │ root     │ disabled │
│ 0  │ typebotwww    │ default     │ N/A     │ fork    │ 760      │ 19s    │ 0    │ online    │ 0%       │ 97.2mb   │ root     │ disabled │
└────┴───────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘</pre>
<p>Salva a configuração atual do PM2 e configura para iniciar com o sistema</p>
<pre class="remontti-code"># pm2 save
# pm2 startup</pre>
<h5>Configuração do Nginx</h5>
<p>Cria os arquivos de configuração do Nginx para os subdomínios</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/typebot.remontti.cum.br.conf</pre>
<pre class="remontti-code-plain">
server {
    listen 80;
    listen [::]:80;
 
    server_name typebot.remontti.cum.br;

    location / {
        proxy_pass http://localhost:54001;
        proxy_set_header Host $host;
    }
}

</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/typebotapi.remontti.cum.br.conf</pre>
<pre class="remontti-code-plain">
server {
    listen 80;
    listen [::]:80;
 
    server_name typebotapi.remontti.cum.br;
 
    location / {
        proxy_pass http://localhost:54002;
        proxy_set_header Host $host;
    }
}
</pre>
<p>Ativa os sites no Nginx</p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/typebot.remontti.cum.br.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/typebotapi.remontti.cum.br.conf /etc/nginx/sites-enabled/
# rm /etc/nginx/sites-enabled/default</pre>
<p>Verifica a sintaxe e reinicia o Nginx</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h5>Configuração do Certbot/Let&#8217;s Encrypt para HTTPS</h5>
<p>Instala o Certbot e o plugin do Nginx</p>
<pre class="remontti-code"># apt install certbot python3-certbot-nginx</pre>
<p>Executa o Certbot para obter os certificados SSL</p>
<pre class="remontti-code">certbot</pre>
<p>Responda: </p>
<pre class="remontti-code-plain">Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter &#039;c&#039; to cancel): noc@remontti.cum.br

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y &lt;&lt;&lt;&lt;&lt;

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let&#039;s Encrypt project and the non-profit organization that
develops Certbot? We&#039;d like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N &lt;&lt;&lt;&lt;
Account registered.

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: typebotapi.remontti.cum.br
2: typebot.remontti.cum.br
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter &#039;c&#039; to cancel):  &lt;&lt;&lt;&lt;
Requesting a certificate for typebotapi.remontti.cum.br and typebot.remontti.cum.br

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/typebotapi.remontti.cum.br/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/typebotapi.remontti.cum.br/privkey.pem
This certificate expires on 2023-12-20.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for typebotapi.remontti.cum.br to /etc/nginx/sites-enabled/typebotapi.remontti.cum.br.conf
Successfully deployed certificate for typebot.remontti.cum.br to /etc/nginx/sites-enabled/typebot.remontti.cum.br.conf
Congratulations! You have successfully enabled HTTPS on https://typebotapi.remontti.cum.br and https://typebot.remontti.cum.br

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let&#039;s Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</pre>
<h5>Configuração do Cron para Renovação Automática do Certificado SSL.</h5>
<p>Adicione uma tarefa cron para renovar automaticamente o certificado SSL todo dia 1 de cada mês à meia-noite, e reinicie o cron.</p>
<pre class="remontti-code"># echo &#039;00 00   1 * *   root    /usr/bin/certbot renew -q&#039; &gt;&gt; /etc/crontab
# systemctl restart cron.service</pre>
<h5>Acessando a aplicação</h5>
<p>Abra seu navegador e acesse: https://typebot.remontti.cum.br<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.cum.br/wp-content/uploads/2023/09/typebot-remontti.png" alt="" width="900" height="403" class="alignnone size-full wp-image-7661" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti.png 900w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti-300x134.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti-768x344.png 768w" sizes="auto, (max-width: 900px) 100vw, 900px" /></p>
<p>Clique em <strong>Registre-se gratuitamente</strong><br />
Escolha a forma desejada.</p>
<h4><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </h4>
<p>Os registros <strong>ficam aberto</strong>, então registre toda sua equipe e em seguida desativa a possibilidade de novos registros nos arquivos .env (<strong>DISABLE_SIGNUP=true</strong>)<br />
Com o comando sed</p>
<pre class="remontti-code"># sed -i &#039;s/DISABLE_SIGNUP=false/DISABLE_SIGNUP=true/&#039; /opt/typebot.io/.env
# sed -i &#039;s/DISABLE_SIGNUP=false/DISABLE_SIGNUP=true/&#039; /opt/typebot.io/apps/viewer/.env
# sed -i &#039;s/DISABLE_SIGNUP=false/DISABLE_SIGNUP=true/&#039; /opt/typebot.io/apps/builder/.env</pre>
<p>Reinicie o pm2 </p>
<pre class="remontti-code"># systemctl restart pm2-root.service</pre>
<p>Se deseja realizar novos cadastros basta alterar <strong>DISABLE_SIGNUP=true</strong> para <strong>DISABLE_SIGNUP=false</strong> e reiniciar novamente.</p>
<pre class="remontti-code"># sed -i &#039;s/DISABLE_SIGNUP=true/DISABLE_SIGNUP=false/&#039; /opt/typebot.io/.env
# sed -i &#039;s/DISABLE_SIGNUP=true/DISABLE_SIGNUP=false/&#039; /opt/typebot.io/apps/viewer/.env
# sed -i &#039;s/DISABLE_SIGNUP=true/DISABLE_SIGNUP=false/&#039; /opt/typebot.io/apps/builder/.env</pre>
<p>Reinicie o pm2 </p>
<pre class="remontti-code"># systemctl restart pm2-root.service</pre>
<p>Se desejar fazer alterações faça os arquivos:</p>
<pre class="remontti-code-plain">/opt/typebot.io/.env
/opt/typebot.io/apps/viewer/.env
/opt/typebot.io/apps/builder/.env</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.cum.br/wp-content/uploads/2023/09/typebot-remontti-1.png" alt="" width="1050" height="411" class="alignnone size-full wp-image-7662" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti-1.png 1050w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti-1-300x117.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti-1-1024x401.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/09/typebot-remontti-1-768x301.png 768w" sizes="auto, (max-width: 1050px) 100vw, 1050px" /></p>
<p>A parte mais complicada está feita!<br />
Existe vários videos no <a href="https://www.youtube.com/results?search_query=typebot" rel="noopener" target="_blank">YouTube</a> sobre como mexer nessa criança. Inclusive no <a href="https://www.youtube.com/@typebot4666" rel="noopener" target="_blank">canal oficial </a>dos desenvolvedores. <em>Dica ative a legenda e selecione traduzir!</em></p>
<p><iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/jp3ggg_42-M?si=xPi09hAm6AqyZfcU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></p>
<p>Gostou e quer me ajudar manter o blog sem a inconveniência de anúncios intrusivos ou a imposição de taxas? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.cum.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.cum.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p><strong>Fonte:</strong><br />
<a href="https://docs.typebot.io/" rel="noopener" target="_blank">https://docs.typebot.io/</a></p>
<p>O post <a href="https://blog.remontti.com.br/7656">Guia Passo a Passo para Instalar o Typebot em seu servidor próprio</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/7656/feed</wfw:commentRss>
			<slash:comments>17</slash:comments>
		
		
			</item>
		<item>
		<title>Instalação do Zabbix 6 LTS + NGINX + PostgreSQL + Debian 12 Bookworm</title>
		<link>https://blog.remontti.com.br/7411</link>
					<comments>https://blog.remontti.com.br/7411#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 14 Jun 2023 18:23:53 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[administração]]></category>
		<category><![CDATA[automação]]></category>
		<category><![CDATA[banco de dados]]></category>
		<category><![CDATA[Configuração]]></category>
		<category><![CDATA[configuração do NGINX]]></category>
		<category><![CDATA[Debian 12 Bookworm]]></category>
		<category><![CDATA[escalabilidade]]></category>
		<category><![CDATA[ferramenta]]></category>
		<category><![CDATA[gerenciamento]]></category>
		<category><![CDATA[infraestrutura]]></category>
		<category><![CDATA[instalaçao]]></category>
		<category><![CDATA[instalação do Zabbix]]></category>
		<category><![CDATA[integração com o PostgreSQL]]></category>
		<category><![CDATA[monitoramento]]></category>
		<category><![CDATA[monitoramento de rede]]></category>
		<category><![CDATA[monitoramento de servidores]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[redes]]></category>
		<category><![CDATA[Segurança]]></category>
		<category><![CDATA[Servidor]]></category>
		<category><![CDATA[servidores web]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[TI]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorial Debian 12 Bookworm]]></category>
		<category><![CDATA[tutorial NGINX]]></category>
		<category><![CDATA[tutorial passo a passo]]></category>
		<category><![CDATA[tutorial PostgreSQL]]></category>
		<category><![CDATA[tutorial Zabbix 6 LTS]]></category>
		<category><![CDATA[Zabbix 6 LTS]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=7411</guid>

					<description><![CDATA[<p>O Zabbix é uma solução de nível enterprise, de código aberto. O Zabbix é um software que monitora vários parâmetros da rede, dos servidores e da saúde dos serviços. Utiliza-se de um mecanismo flexível&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/7411">Instalação do Zabbix 6 LTS + NGINX + PostgreSQL + Debian 12 Bookworm</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/zabbix_6_debian_12.jpg" alt="" width="720" height="340" class="alignnone size-full wp-image-7421" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/zabbix_6_debian_12.jpg 720w, https://blog.remontti.com.br/wp-content/uploads/2023/06/zabbix_6_debian_12-300x142.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/zabbix_6_debian_12-520x245.jpg 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /></p>
<p>O <strong>Zabbix</strong> é uma solução de nível enterprise, de código aberto. O Zabbix é um software que monitora vários parâmetros da rede, dos servidores e da saúde dos serviços. Utiliza-se de um mecanismo flexível de notificação que permite configurar alertas por e-mail entre outros como Telegram, para praticamente qualquer evento. As notificações permitem que se reaja rapidamente à problemas no ambiente. O Zabbix oferece excelentes recursos de relatórios e visualização de dados armazenados. Isso faz com que o Zabbix seja a ferramenta ideal para planejamento de capacidade.</p>
<h4>Requisitos Debian 12 Bookworm </h4>
<p>&#8211; <a href="https://blog.remontti.com.br/7236" rel="noopener" target="_blank">Instalação do Debian 12 Bookworm limpa passo-a-passo</a><br />
&#8211; <a href="https://blog.remontti.com.br/7413" rel="noopener" target="_blank">Servidor WEB NGINX + PHP 8.2 + PostgreSQL +Let’s Encrypt Debian 12 Bookworm (LNP)</a></p>
<h1>Instalação do Zabbix 6 LTS </h1>
<p>Para instalação do Zabbix vamos incluir o repositório do oficial do Zabbix Versão 6 LTS.</p>
<pre class="remontti-code"># su -
# cd /tmp
# apt install wget</pre>
<p><strong>Repositório  Debian 12</strong></p>
<pre class="remontti-code"># cd /tmp/
# wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-5+debian12_all.deb
# apt install ./zabbix-release_6.0-5+debian12_all.deb
# apt update; apt upgrade -y; apt update</pre>
<pre class="remontti-code"># apt install zabbix-server-pgsql zabbix-frontend-php php-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent</pre>
<p>Vamos criar uma base de dados chamada <strong>zabbix</strong> e um usuário também chamado de zabbix no PostgreSQL.<br />
Não esqueça de alterar a senha: Use o gerador de senha: <a href="https://senhasegura.remontti.com.br/" rel="noopener noreferrer" target="_blank">https://senhasegura.remontti.com.br/</a></p>
<pre class="remontti-code"># su - postgres
$ createuser --pwprompt zabbix
Digite a senha para a nova role:  &lt;SENHA ZABBIX&gt;
Digite-a novamente: &lt;SENHA ZABBIX&gt;
Senha: &lt;SENHA POSTGRES CASO TENHA DEFINIDO NA INSTALAÇÃO DO MESMO&gt;

$ createdb -O zabbix zabbix
Senha: &lt;SENHA POSTGRES&gt;</pre>
<p>Importe o esquema inicial e os dados. Você será solicitado a inserir a senha que foi criada anteriormente.</p>
<pre class="remontti-code">$ zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | psql -U zabbix -d zabbix &amp;&gt;/dev/null
Senha para usuário zabbix: : &lt;SENHA ZABBIX&gt;
$ exit</pre>
<p>Edite o arquivo zabbix_server.conf para informar os dados para conexão com do PostgreSQL.</p>
<pre class="remontti-code"># vim /etc/zabbix/zabbix_server.conf</pre>
<p>Procure por <strong># DBPassword=</strong> descomente e sete sua senha.</p>
<pre class="remontti-code">#...
DBPassword=&lt;SENHA ZABBIX&gt;
#...</pre>
<p>Ajuste o arquivo /etc/zabbix/php-fpm.conf, descomente e defina o fuso horário correto. <a href="https://secure.php.net/manual/pt_BR/timezones.america.php" rel="noopener noreferrer" target="_blank">timezone</a> Sua região</a>.</p>
<pre class="remontti-code"># vim /etc/zabbix/php-fpm.conf</pre>
<p>Adicione:</p>
<pre class="remontti-code">php_value[date.timezone] = America/Sao_Paulo</pre>
<p>Ajuste as configurações do nginx.</p>
<pre class="remontti-code"># vim /etc/nginx/conf.d/zabbix.conf </pre>
<p>Deixei algumas linhas comentadas como exemplo, faça de acordo com sua necessidade.</p>
<pre class="remontti-code">server {
        listen 80;
        listen [::]:80;
        server_name    zabbix.remontti.com.br localhost;
        #server_name   OU_SEU_IP;

        # Metodo simples para quem quer rodar em uma determinada porta
        #listen 8181;
        #listen [::]:8181;
        #server_name     _;

        root    /usr/share/zabbix;
        index   index.php;

        # Desmomente para deixar restringido apenas para determinados prefixos
        #allow  192.168.87.0/24;
        #allow  127.0.0.1;
        #allow  2001:0db8::/32;
        #allow  ::1;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;

        client_max_body_size 100M;
 
        location = /favicon.ico {
                log_not_found   off;
        }

        location / {
                try_files       $uri $uri/ =404;
        }

        location /assets {
                access_log      off;
                expires         10d;
        }

        location ~ /\.ht {
                deny            all;
        }

        location ~ /(api\/|conf[^\.]|include|locale) {
                deny            all;
                return          404;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_pass    unix:/var/run/php/zabbix.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index   index.php;

                fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
                fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
                fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

                include fastcgi_params;
                fastcgi_param   QUERY_STRING    $query_string;
                fastcgi_param   REQUEST_METHOD  $request_method;
                fastcgi_param   CONTENT_TYPE    $content_type;
                fastcgi_param   CONTENT_LENGTH  $content_length;

                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout         60;
                fastcgi_send_timeout            180;
                fastcgi_read_timeout            180;
                fastcgi_buffer_size             128k;
                fastcgi_buffers                 4 256k;
                fastcgi_busy_buffers_size       256k;
                fastcgi_temp_file_write_size    256k;
        }
}
</pre>
<p>Inicie o servidor Zabbix e os processos do agente e configure-os para que sejam iniciados durante o boot do sistema.</p>
<pre class="remontti-code"># systemctl enable zabbix-server zabbix-agent</pre>
<pre class="remontti-code"># vim /etc/php/8.2/fpm/php.ini</pre>
<p>Localize <strong>max_execution_time</strong> e altere de 30 para 600</p>
<pre class="remontti-code">max_execution_time = 600</pre>
<pre class="remontti-code"># systemctl restart zabbix-server zabbix-agent nginx php8.2-fpm</pre>
<p>Acesse em seu navegador <strong>http://seu_ip:porta</strong> ou <strong>http://zabbix.seudominio.com.br</strong></p>
<p><strong>Selecione o Edioma, e Próximo passo</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_1.png" alt="" width="1562" height="827" class="alignnone size-full wp-image-6360" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_1.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_1-300x159.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_1-1024x542.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_1-768x407.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_1-1536x813.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p>Se tudo estiver ok: <strong>Próximo passo</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_2.png" alt="" width="1562" height="1275" class="alignnone size-full wp-image-6361" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_2.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_2-300x245.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_2-1024x836.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_2-768x627.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_2-1536x1254.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p>Selecione <strong>PostgreSQL</strong> e informe a <strong>senha do usuário zabbix </strong>criada anteriormente, clique em <strong>Próximo passo</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_3.png" alt="" width="1562" height="804" class="alignnone size-full wp-image-6362" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_3.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_3-300x154.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_3-1024x527.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_3-768x395.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_3-1536x791.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p><strong>Defina um nome, e selecione o Tema padrão e clique em Próximo passo</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_4.png" alt="" width="1562" height="766" class="alignnone size-full wp-image-6363" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_4.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_4-300x147.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_4-1024x502.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_4-768x377.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_4-1536x753.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p><strong>Se tudo estiver ok, Próximo passo</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_5.png" alt="" width="1562" height="766" class="alignnone size-full wp-image-6364" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_5.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_5-300x147.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_5-1024x502.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_5-768x377.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_5-1536x753.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p><strong>Fim</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_6.png" alt="" width="1562" height="766" class="alignnone size-full wp-image-6365" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_6.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_6-300x147.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_6-1024x502.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_6-768x377.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_6-1536x753.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p>Entre com Usuário <strong>Admin</strong> e senha <strong>zabbix</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_7.png" alt="" width="1562" height="766" class="alignnone size-full wp-image-6366" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_7.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_7-300x147.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_7-1024x502.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_7-768x377.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_7-1536x753.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_8.png" alt="" width="1562" height="1151" class="alignnone size-full wp-image-6367" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_8.png 1562w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_8-300x221.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_8-1024x755.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_8-768x566.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/02/zabbix_6_install_8-1536x1132.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></p>
<p>Simples né? Gostou e quer me ajudar? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p>Fontes:<br />
<a href="https://www.zabbix.com/documentation/" rel="noopener" target="_blank">https://www.zabbix.com/documentation/</a></p>
<p>O post <a href="https://blog.remontti.com.br/7411">Instalação do Zabbix 6 LTS + NGINX + PostgreSQL + Debian 12 Bookworm</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/7411/feed</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>Servidor WEB NGINX + PHP 8.2 + PostgreSQL +Let’s Encrypt  Debian 12 Bookworm (LNP)</title>
		<link>https://blog.remontti.com.br/7413</link>
					<comments>https://blog.remontti.com.br/7413#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 14 Jun 2023 17:32:09 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[bookworm]]></category>
		<category><![CDATA[Debian 12]]></category>
		<category><![CDATA[Let’s Encrypt]]></category>
		<category><![CDATA[LNP]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[PHP 8.2]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[Servidor WEB]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=7413</guid>

					<description><![CDATA[<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/7413">Servidor WEB NGINX + PHP 8.2 + PostgreSQL +Let’s Encrypt  Debian 12 Bookworm (LNP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lnp_debian_12-1.jpg" alt="" width="720" height="340" class="alignnone size-full wp-image-7423" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lnp_debian_12-1.jpg 720w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lnp_debian_12-1-300x142.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lnp_debian_12-1-520x245.jpg 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /></p>
<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor performance. O Apache, sem dúvidas, é o servidor web mais popular. No entanto, o NGINX a cada ano ganha mais popularidade e está sendo a preferência dos novos projetos. Também estarei instalando o banco de dados PostgreSQL e phpPgAdmin como gerenciador web. </p>
<p>Distribuição utilizada: <strong><a href="https://blog.remontti.com.br/7236" rel="noopener noreferrer" target="_blank">Debian 12 Bookworm / Instalação Limpa</a></strong></p>
<h3>NGINX 1.22</h3>
<p><a href="https://www.nginx.com" rel="noopener" target="_blank">https://www.nginx.com</a><br />
Vamos instalar-lo e remover a assinatura para que não vejam a versão do mesmo (Boas praticas)</p>
<pre class="remontti-code"># apt install nginx
# sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<p>Acesse agora em seu navegador http://IP-SERVIDOR/<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png" alt="" width="1100" height="310" class="alignnone size-full wp-image-5467" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png 1100w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-1024x289.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-768x216.png 768w" sizes="auto, (max-width: 1100px) 100vw, 1100px" /><br />
Pronto nosso NGINX está rodando! </p>
<h3>PostgreSQL</h3>
<pre class="remontti-code"># apt install postgresql postgresql-contrib</pre>
<p>Torne-se o usuário postgres, para poder criar o banco de dados.</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Execute para entrar no terminal de comandos do banco.</p>
<pre class="remontti-code">$ psql</pre>
<p>Para definir a senha do usuário postgres e instalar o adminpack.</p>
<pre class="remontti-code">postgres=# \password postgres
Digite nova senha para postgres: 
Digite-a novamente:
postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION
postgres=# \q 
$ exit</pre>
<p>Ajustes no pg_hba.conf, assim toda alteração será necessaria validação do postgres com a senha que acabou de definir.</p>
<pre class="remontti-code"># vim /etc/postgresql/15/main/pg_hba.conf</pre>
<p>Altere as seguintes linhas: </p>
<pre class="remontti-code">local   all             postgres                                peer
local   all             all                                     peer</pre>
<p>Para:</p>
<pre class="remontti-code">local   all             postgres                                md5
local   all             all                                     md5</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png" alt="" width="1010" height="268" class="alignnone size-full wp-image-5501" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png 1010w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-300x80.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-768x204.png 768w" sizes="auto, (max-width: 1010px) 100vw, 1010px" /><br />
Reinicie o postgres</p>
<pre class="remontti-code"># systemctl restart postgresql</pre>
<p>Volte para o postgres</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Agora para toda ação será necessário autenticar.</p>
<pre class="remontti-code">$ psql 
Senha para usuário postgres: !!SUA_SENHA!!
psql (15.3 (Debian 15.3-0+deb12u1))
Type &quot;help&quot; for help.
postgres-# \q</pre>
<p>Para demonstração irei criar um banco/usuário teste, não esqueça de alterar a senha.</p>
<pre class="remontti-code">$ createuser --pwprompt teste
Digite a senha para a nova role: &lt;&lt; NOVA SENHA PARA O USUÁRIO TESTE
Digite-a novamente: &lt;&lt; REPITA
Senha: &lt;&lt; SENHA DO QUE SETOU ANTES  NO COMANDO &quot;\password postgres&quot;</pre>
<p>Agora crie o  banco e vincule ao usuário.</p>
<pre class="remontti-code">$ createdb -O teste meubd
Senha: &lt;&lt;&lt; SENHA DO POSTGRES </pre>
<p>Verifique se o mesmo foi criado.</p>
<pre class="remontti-code">$ psql -l 
Senha para usuário postgres: 
                               Lista dos bancos de dados
   Nome    |   Dono   | Codificação |   Collate   |    Ctype    | Privilégios de acesso 
-----------+----------+-------------+-------------+-------------+-----------------------
 meubd     | teste    | UTF8        | pt_BR.UTF-8 | pt_BR.UTF-8 | 
....
....</pre>
<p>Acessamos agora o bd teste.</p>
<pre class="remontti-code">$ psql -U teste -d meubd
Senha do usuário teste: 
psql (15.3 (Debian 15.3-0+deb12u1))
Digite &quot;help&quot; para ajuda.

meubd=&gt;</pre>
<p>Vamos fazer uma "brincadeira" só para testar, criaremos uma tabela e inseriremos dados nela.</p>
<pre class="remontti-code">meubd=&gt; CREATE TABLE doacao ( id int,nome text, valor text );
meubd=&gt; INSERT INTO doacao (id,nome,valor) values (1,&#039;Rudimar Remontti&#039;,&#039;R$ 5,00&#039;); 
meubd=&gt; SELECT * FROM doacao;

 id |       nome       |  valor  
----+------------------+---------
  1 | Rudimar Remontti | R$ 5,00

meubd=&gt; \q</pre>
<p>Se deseja remover o banco/usuário teste.</p>
<pre class="remontti-code">$ dropdb meubd
Senha: &lt;&lt; SENHA DO POSTGRES
$ dropuser teste
Senha: &lt;&lt; SENHA DO POSTGRES</pre>
<p>Volte para root</p>
<pre class="remontti-code">$ exit</pre>
<h3>PHP 8.2</h3>
<p>Incluirei algumas extensões do PHP que são normalmente utilizada também na instalação.</p>
<pre class="remontti-code">#  apt install --no-install-recommends \
 php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}</pre>
<p>Agora vamos fazer a "integração" do PHP com o NGINX. Moveremos o arquivo defaul.</p>
<pre class="remontti-code"># mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original</pre>
<p>Crie um novo:</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Ajuste:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}</pre>
<p>Teste a configuração se não tem nada errado e restart os serviços:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx php8.2-fpm</pre>
<p>Vamos criar um arquivo em PHP para testa se nosso NGINX está interpretando o PHP.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo();&#039; &gt;&gt; /var/www/html/teste.php</pre>
<p>Acesse em seu navegador <strong>http://IP-SERVIDOR/teste.php</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2.png" data-rel="lightbox-gallery-Ehc3cUWX" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2-300x292.png" alt="" width="300" height="292" class="alignnone size-medium wp-image-7417" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2-300x292.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2-768x748.png 768w, https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2.png 950w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Servidor WEB com PHP está funcionando! </p>
<p>Exemplo para multiplos domínios/subdomínios </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub1.conf</pre>
<p>Neste ex: vou representar o <em>sub1.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub1;
    index index.php index.html index.htm;

    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;

    server_name sub1.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub2e3.conf</pre>
<p>Neste ex: vou representar o <em>sub2.remontti.com.br</em> e <em>sub3.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name sub2.remontti.com.br sub3.remontti.com.br;

    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}</pre>
<p>Link os arquivos no diretório "/etc/nginx/sites-available"  que será carregado as novas configurações </p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/sub1.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/sub2e3.conf /etc/nginx/sites-enabled/</pre>
<p>Crie os diretórios referente a cada <strong>server_name</strong>.</p>
<pre class="remontti-code"># mkdir /var/www/sub1
# mkdir /var/www/sub2e3
# echo &#039;&lt;?php echo &quot;Olá mundo do sub1!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub1/index.php
# echo &#039;&lt;?php echo &quot;Olá mundo do sub2e3!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub2e3/index.php
</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h3>:: Let's Encrypt ::</h3>
<p>Criando certificado grátis para seus sub/domínios.</p>
<pre class="remontti-code"># apt install certbot python3-certbot-nginx</pre>
<p>Para gerar o certificado use o comando:</p>
<pre class="remontti-code"># certbot</pre>
<p>Não esqueça de colocar no seu cron para ele renovar o certificado, pois a cada 90 ele expira. Neste exemplo todo dia primeiro tento renovar.</p>
<pre class="remontti-code"># certbot -q renew</pre>
<p>Para testar acesse: <a href="https://www.cdn77.com/tls-test/" rel="noopener" target="_blank">https://www.cdn77.com/tls-test/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png" data-rel="lightbox-gallery-Ehc3cUWX" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png" alt="" width="300" height="182" class="alignnone size-medium wp-image-6158" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-1024x620.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-768x465.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png 1099w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fontes:</strong> <a href="https://docs.nginx.com/" rel="noopener" target="_blank">https://docs.nginx.com/</a><br />
<a href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/" rel="noopener" target="_blank">https://docs.nginx.com/nginx/admin-guide/web-server/web-server/</a></p>
<p>O post <a href="https://blog.remontti.com.br/7413">Servidor WEB NGINX + PHP 8.2 + PostgreSQL +Let’s Encrypt  Debian 12 Bookworm (LNP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/7413/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Servidor WEB NGINX + PHP 8.2 + MariaDB + phpMyAdmin + Let’s Encrypt Debian 12 Bookworm (LNMP)</title>
		<link>https://blog.remontti.com.br/7460</link>
					<comments>https://blog.remontti.com.br/7460#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 14 Jun 2023 15:17:45 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bookworm]]></category>
		<category><![CDATA[Debian 12]]></category>
		<category><![CDATA[Let’s Encrypt]]></category>
		<category><![CDATA[LNMP]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[Servidor WEB]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=7460</guid>

					<description><![CDATA[<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/7460">Servidor WEB NGINX + PHP 8.2 + MariaDB + phpMyAdmin + Let’s Encrypt Debian 12 Bookworm (LNMP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><center><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian12.jpg" alt="" width="720" height="340" class="alignnone size-full wp-image-7476" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian12.jpg 720w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian12-300x142.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian12-520x245.jpg 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /></center></p>
<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor performance. O Apache, sem dúvidas, é o servidor web mais popular. No entanto, o NGINX a cada ano ganha mais popularidade e está sendo a preferência dos novos projetos.</p>
<p>Distribuição utilizada: <strong><a href="https://blog.remontti.com.br/7236" rel="noopener noreferrer" target="_blank">Debian 12 Stretch / Instalação Limpa</a></strong></p>
<h3>NGINX</h3>
<p><a href="https://www.nginx.com" rel="noopener" target="_blank">https://www.nginx.com</a><br />
Vamos instalar-lo e remover a assinatura para que não vejam a versão do mesmo (Boas praticas)</p>
<pre class="remontti-code"># apt install nginx
# sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<p>Acesse agora em seu navegador http://IP-SERVIDOR/<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png" alt="" width="1100" height="310" class="alignnone size-full wp-image-5467" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png 1100w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-1024x289.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-768x216.png 768w" sizes="auto, (max-width: 1100px) 100vw, 1100px" /></p>
<p>Pronto nosso NGINX está rodando! </p>
<h3>MARIADB</h3>
<p>MariaDB para quem ainda não sabe é um fork do MySQL, criado pelo próprio fundador do projeto MySQL após sua aquisição pela Oracle.</p>
<pre class="remontti-code"># apt install mariadb-server mariadb-client</pre>
<p>Ao final do tutorial iremos colocar uma senha para o usuario root do mariadb. Não iremos fazer isso agora para não dar problema na instalação do phpmyadmin.</p>
<h3>PHP 8.2</h3>
<p>Incluirei algumas extensões do PHP que são normalmente utilizada também na instalação.</p>
<pre class="remontti-code"># apt install --no-install-recommends \
 php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}</pre>
<p>Agora vamos fazer a &#8220;integração&#8221; do PHP com o NGINX. Moveremos o arquivo defaul.</p>
<pre class="remontti-code"># mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original</pre>
<p>Crie um novo:</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Ajuste:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}</pre>
<p>Teste a configuração se não tem nada errado e restart os serviços:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx php8.2-fpm</pre>
<p>Vamos criar um arquivo em PHP para testa se nosso NGINX está interpretando o PHP.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo();&#039; &gt;&gt; /var/www/html/teste.php</pre>
<p>Acesse em seu navegador http://IP-SERVIDOR/teste.php<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2.png" alt="" width="950" height="925" class="alignnone size-full wp-image-7417" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2.png 950w, https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2-300x292.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2-768x748.png 768w" sizes="auto, (max-width: 950px) 100vw, 950px" /><br />
Servidor WEB com PHP está funcionando! </p>
<p>Exemplo para múltiplos domínios/subdomínios </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub1.conf</pre>
<p>Neste ex: vou representar o <em>sub1.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub1;
    index index.php index.html index.htm;

    server_name sub1.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub2e3.conf</pre>
<p>Neste ex: vou representar o <em>sub2.remontti.com.br</em> e <em>sub3.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name sub2.remontti.com.br sub3.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}</pre>
<p>Link os arquivos no diretório &#8220;/etc/nginx/sites-available&#8221;  que será carregado as novas configurações </p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/sub1.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/sub2e3.conf /etc/nginx/sites-enabled/</pre>
<p>Crie os diretórios referente a cada <strong>server_name</strong>.</p>
<pre class="remontti-code"># mkdir /var/www/sub1
# mkdir /var/www/sub2e3
# echo &#039;&lt;?php echo &quot;Olá mundo do sub1!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub1/index.php
# echo &#039;&lt;?php echo &quot;Olá mundo do sub2e3!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub2e3/index.php
</pre>
<p>Verifique se não tem nenhum erro e restart:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h3>phpMyAdmin</h3>
<pre class="remontti-code"># apt install phpmyadmin -y </pre>
<p>Não selecione nenhum, apenas <strong>OK</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12.png" alt="" width="1239" height="424" class="alignnone size-full wp-image-7467" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12.png 1239w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12-300x103.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12-1024x350.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12-768x263.png 768w" sizes="auto, (max-width: 1239px) 100vw, 1239px" /></p>
<p>Responda <strong>Sim</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12_nginx.png" alt="" width="1249" height="370" class="alignnone size-full wp-image-7468" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12_nginx.png 1249w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12_nginx-300x89.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12_nginx-1024x303.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_debian12_nginx-768x228.png 768w" sizes="auto, (max-width: 1249px) 100vw, 1249px" /></p>
<p>Irá solicitar a senha para a base de dados <strong>phpmyadmin</strong>, informe sua <strong>senha e repita</strong>. </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Adicione as linhas destacadas:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }

    location ^~ /phpmyadmin {
        root /usr/share;
        try_files $uri $uri/ =404;
        #allow  192.168.87.0/24;
        #allow  2001:0db8::/32;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;
        location ~ .php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        }
    }

}</pre>
<p>Se deseja tonar o phpmyadmin acessivel apenas de alguns endereços IPs basta descomentar as linhas, e incluir seus prefixos. O error_page é para que quando a o acessante levar um proibido seja direcionado para um site.</p>
<pre class="remontti-code">allow  192.168.87.0/24;
allow  2001:0db8::/32;
deny   all;
error_page  403   http://www.remontti.com.br;</pre>
<p>Verifique se não tem nenhum erro e restart:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<p>Acesse agora <strong>http://SERVIDOR/phpmyadmin</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_login.png" alt="" width="1523" height="556" class="alignnone size-full wp-image-7471" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_login.png 1523w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_login-300x110.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_login-1024x374.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_login-768x280.png 768w" sizes="auto, (max-width: 1523px) 100vw, 1523px" /></p>
<h4>Definindo senha para o root do mariaDB</h4>
<p>Por segurança vamos setar uma senha do usuario root do MariaDB</p>
<pre class="remontti-code"># mariadb -u root</pre>
<p>Para aumentar a seguraçã vamos definir uma senha para o usuário root do MariDB, não esqueça de alterar ALTERE_3ST4_SENHA pela sua senha. Dica acesse<a href="https://senhasegura.remontti.com.br/" rel="noopener" target="_blank"> https://senhasegura.remontti.com.br/</a> e gere uma!</p>
<pre class="remontti-code">USE mysql;
ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;ALTERE_3ST4_SENHA&#039;;
FLUSH PRIVILEGES;
EXIT;
</pre>
<p>Apague seus rastros, em /root/.mysql_history temos um histórico com todos os comandos dado no terminal do MariaDB, então não é legal deixar lá em texto puro a senha que setamos!</p>
<pre class="remontti-code"># &gt; /root/.mysql_history</pre>
<p>Agora quando for acessar o mariadb será necessário informar a senha juntamente da opção <strong>-p</strong>.</p>
<pre class="remontti-code"># mariadb -u root -p</pre>
<pre class="remontti-code-plain">Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 46
Server version: 10.11.3-MariaDB-1 Debian 12

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the current input statement.

MariaDB [(none)]&gt; exit;
Bye
</pre>
<h3>Let&#8217;s Encrypt</h3>
<p>Criando certificado grátis para seus sub/domínios.</p>
<pre class="remontti-code"># apt install certbot python3-certbot-nginx</pre>
<p>Para gerar o certificado use o comando:</p>
<pre class="remontti-code"># certbot</pre>
<p>Não esqueça de colocar no seu cron para ele renovar o certificado, pois a cada 90 ele expira. Neste exemplo todo dia primeiro tento renovar.</p>
<pre class="remontti-code"># certbot -q renew</pre>
<p>Para testar acesse: <a href="https://www.cdn77.com/tls-test/" rel="noopener" target="_blank">https://www.cdn77.com/tls-test/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png" data-rel="lightbox-gallery-pBhrzhez" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png" alt="" width="300" height="182" class="alignnone size-medium wp-image-6158" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-1024x620.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-768x465.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png 1099w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Gostou?</p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fontes:</strong> <a href="https://docs.nginx.com/" rel="noopener" target="_blank">https://docs.nginx.com/</a><br />
<a href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/" rel="noopener" target="_blank">https://docs.nginx.com/nginx/admin-guide/web-server/web-server/</a></p>
<p>O post <a href="https://blog.remontti.com.br/7460">Servidor WEB NGINX + PHP 8.2 + MariaDB + phpMyAdmin + Let’s Encrypt Debian 12 Bookworm (LNMP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/7460/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Instalação do Nginx Proxy Manager</title>
		<link>https://blog.remontti.com.br/6561</link>
					<comments>https://blog.remontti.com.br/6561#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Sat, 18 Jun 2022 19:07:54 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[administração web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[autenticação HTTP]]></category>
		<category><![CDATA[cgnat]]></category>
		<category><![CDATA[configuração de rede]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 11]]></category>
		<category><![CDATA[Debian 12]]></category>
		<category><![CDATA[Debian 12 Bookworm]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[Docker Compose]]></category>
		<category><![CDATA[gerenciamento de certificados]]></category>
		<category><![CDATA[instalação de software]]></category>
		<category><![CDATA[letsencrypt]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[Nginx Proxy Manager]]></category>
		<category><![CDATA[otimização de servidor]]></category>
		<category><![CDATA[proxy reverso]]></category>
		<category><![CDATA[proxy-cache]]></category>
		<category><![CDATA[segurança de aplicação]]></category>
		<category><![CDATA[SSL grátis]]></category>
		<category><![CDATA[tutorial de tecnologia]]></category>
		<category><![CDATA[webserver]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=6561</guid>

					<description><![CDATA[<p>O que é o Nginx Proxy Manager? É um sistema que possui uma interface web limpa, eficiente e fácil de configurar, sem precisar saber muito sobre Nginx ou Letsencrypt. Característica &#8211; Interface de administração&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/6561">Instalação do Nginx Proxy Manager</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_cover.png" alt="" width="720" height="340" class="alignnone size-full wp-image-6588" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_cover.png 720w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_cover-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_cover-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /></p>
<p>O que é o <a href="https://nginxproxymanager.com/guide/#project-goal"><strong>Nginx Proxy Manager</strong></a>?<br />
É um sistema que possui uma interface web limpa, eficiente e fácil de configurar, sem precisar saber muito sobre Nginx ou Letsencrypt.</p>
<p><b>Característica</b><br />
 &#8211; Interface de administração bonita e segura baseada<br />
 &#8211; Crie facilmente domínios de encaminhamento, redirecionamentos, streams e hosts 404 sem saber nada sobre Nginx<br />
 &#8211; SSL grátis usando Let&#8217;s Encrypt ou forneça seus próprios certificados SSL personalizados<br />
 &#8211; Listas de acesso e autenticação HTTP básica para seus hosts<br />
 &#8211; Configuração avançada do Nginx disponível para superusuários<br />
 &#8211; Gerenciamento de usuários, permissões e log de auditoria</p>
<p><strong>Distribuição testadas:</strong><br />
<a href="https://blog.remontti.com.br/7236" rel="noopener" target="_blank">Debian 12 Bookworm</a><br />
<a href="https://blog.remontti.com.br/5792" rel="noopener" target="_blank"><del datetime="2024-08-23T13:04:44+00:00">Debian 11 Bullseye</del></a></p>
<p><a href="https://blog.remontti.com.br/5867" rel="noopener" target="_blank">Como melhorar a produtividade no seu Debian após instalação</a> (Recomendado)</p>
<p><strong>Porta Utilizadas</strong><br />
81  &#8211; Porta de administração do Nginx Proxy Manager<br />
80  &#8211; Porta HTTP pública<br />
443 &#8211; Porta HTTP pública</p>
<h4>Configurações de interface de Rede</h4>
<p>Para a configuração da interface de rede vou usar uma configuração <strong>Pointopoint</strong> (Ponto a ponto) assim utilizando de apenas um endereço IP público, você pode (deve) <a href="https://blog.remontti.com.br/5848" rel="noopener" target="_blank">ler este tutorial</a> para conhecer varias possibilidades de configuração de rede pensa em como economizar endereços IPs.</p>
<pre class="remontti-code"># vim /etc/network/interfaces</pre>
<p>No meu exemplo vamos pesar que esse servidor esteja conectado ao RouterOS/Mikrotik ether2 e meu endereço de IP publico será o <em>200.200.200.255</em></p>
<pre class="remontti-code-plain">allow-hotplug enp0s3
iface enp0s3 inet static
        address 200.200.200.255
        pointopoint 192.168.171.171
        netmask 255.255.255.255
        gateway 192.168.171.171
</pre>
<p>Agora no seu RouterOS vamos criar nosso Pointopoint gatewai 192.168.171.171 tendo como network o endereço IP público.</p>
<pre class="remontti-code-plain">RouterOS# /ip address
RouterOS# add address=192.168.171.171 comment=Pointopoint interface=ether2 network=200.200.200.255</pre>
<p>Se você não tem IP publico para colocar em seu servidor, então fixe um endereço IP Privado e redirecione as potas 80,81 e 443 para ele, utilizando seu IP público que está em seu router. Exemplo:</p>
<pre class="remontti-code-plain">allow-hotplug enp0s3
iface enp0s3 inet static
        address 10.10.10.2/24
        gateway 10.10.10.1</pre>
<p>E é clario se você conter endereço IPv6, não deixe de configurar sua placa! Exemplo:</p>
<pre class="remontti-code-plain">iface enp0s3 inet6 static
        pre-up modprobe ipv6
        address 2804:bebe:cafe::2
        netmask 64
        gateway 2804:bebe:cafe::1</pre>
<h4>Instalação Docker</h4>
<p>Iremos instalar os pacotes necessários, bem como adicionar o repositório oficial do Docker</p>
<pre class="remontti-code"># apt install ca-certificates curl gnupg2 apt-transport-https lsb-release
# curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
# echo &quot;deb https://download.docker.com/linux/debian $(lsb_release -cs) stable&quot; &gt; /etc/apt/sources.list.d/docker.list</pre>
<p>Atualize o repositório e instale-o</p>
<pre class="remontti-code"># apt update
# apt install docker-ce docker-ce-cli containerd.io</pre>
<h4>Instalação Docker Compose</h4>
<p>Vamos fazer download do Docker Compose, e adicionar aos binários do nosso servidor como um executável. </p>
<pre class="remontti-code"># curl -L &quot;https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-$(uname -s)-$(uname -m)&quot; -o /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose</pre>
<p>Versão baixada foi a 2.24.5, mas você pode consultar uma mais recente em: <a href="https://github.com/docker/compose/releases/" rel="noopener" target="_blank">https://github.com/docker/compose/releases/</a>, para verificar qual versão instalado use:</p>
<pre class="remontti-code"># docker-compose --version</pre>
<pre class="remontti-code-plain">Docker Compose version v2.24.5</pre>
<h4>Instação Nginx Proxy Manager</h4>
<p>Crie os diretórios quais ficarão todas as configurações:</p>
<pre class="remontti-code"># mkdir /etc/nginx-proxy
# mkdir /etc/nginx-proxy/{data,letsencrypt}</pre>
<p>Crie seu arquivo de composição do Docker com as configuração, para realizar a instalação dos containers do Nginx Proxy Manager e MariaDB com o Docker Compose. (Ajustes as senhas)</p>
<pre class="remontti-code"># vim /etc/nginx-proxy/docker-compose.yml</pre>
<p>Adicione:</p>
<pre class="remontti-code-plain">version: &quot;3&quot;
services:
  app:
    image: &#039;jc21/nginx-proxy-manager:latest&#039;
    restart: unless-stopped
    ports:
      # These ports are in format &lt;host-port&gt;:&lt;container-port&gt;
      - &#039;80:80&#039;       # Porta HTTP pública
      - &#039;443:443&#039;     # Porta HTTPS pública
      - &#039;81:81&#039; # Porta de administracao do Nginx Proxy
      # Adicione qualquer outra porta Stream que você queira expor, ex
      # - &#039;21:21&#039; # FTP
    environment:
      DB_MYSQL_HOST: &quot;db&quot;
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: &quot;nginxproxy&quot;
      DB_MYSQL_PASSWORD: &quot;S3NHA_NGINX_PR0XY&quot;
      DB_MYSQL_NAME: &quot;nginxproxy&quot;
      # Remova o comentário se você não tem o IPv6 em seu host
      # DISABLE_IPV6: &#039;true&#039;
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: &#039;jc21/mariadb-aria:latest&#039;
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: &#039;S3NHA_D3_R00T&#039;
      MYSQL_DATABASE: &#039;nginxproxy&#039;
      MYSQL_USER: &#039;nginxproxy&#039;
      MYSQL_PASSWORD: &#039;S3NHA_NGINX_PR0XY&#039;
    volumes:
      - ./mysql:/var/lib/mysql</pre>
<p>Execute o comando Docker Compose</p>
<pre class="remontti-code"># cd /etc/nginx-proxy
# docker-compose up -d</pre>
<p>Aguarde finalizar&#8230; em seguida visualize se os containers que foram criados</p>
<pre class="remontti-code"># docker ps -a</pre>
<pre class="remontti-code-plain">
CONTAINER ID   IMAGE                             COMMAND             CREATED          STATUS         PORTS                                                                                  NAMES
6b796a07af22   jc21/nginx-proxy-manager:latest   &quot;/init&quot;             9 seconds ago    Up 7 seconds   0.0.0.0:80-81-&gt;80-81/tcp, :::80-81-&gt;80-81/tcp, 0.0.0.0:443-&gt;443/tcp, :::443-&gt;443/tcp   nginx-proxy-app-1
4c93d3b8a544   jc21/mariadb-aria:latest          &quot;/scripts/run.sh&quot;   13 seconds ago   Up 8 seconds   3306/tcp                                                                               nginx-proxy-db-1
</pre>
<p>Abra em navegador <strong>http://IP_SERVIDOR/</strong> se tudo ocorreu bem você verá:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_1.png" alt="" width="1274" height="666" class="alignnone size-full wp-image-6566" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_1.png 1274w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_1-300x157.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_1-1024x535.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_1-768x401.png 768w" sizes="auto, (max-width: 1274px) 100vw, 1274px" /></p>
<p>Agora abra na porta 81 <strong>http://IP_SERVIDOR:81/</strong> e entre com:</p>
<pre class="remontti-code-plain">Email: admin@example.com 
Password: changeme</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_2a.png" alt="" width="1255" height="661" class="alignnone size-full wp-image-6576" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_2a.png 1255w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_2a-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_2a-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_2a-768x405.png 768w" sizes="auto, (max-width: 1255px) 100vw, 1255px" /><br />
Ao entrar pela primeira vez um formulário com informações será exibido para você alterar seus dados, <strong>altere seus e-mail e senha</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_3_a.png" alt="" width="1257" height="664" class="alignnone size-full wp-image-6575" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_3_a.png 1257w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_3_a-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_3_a-1024x541.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_3_a-768x406.png 768w" sizes="auto, (max-width: 1257px) 100vw, 1257px" /></p>
<h4>Configurações de DNS Autoritativa</h4>
<p>Para que possamos encaminhar os acessos iremos necessitar configurar um subdomínios para cada situação em nosso servidor <a href="https://blog.remontti.com.br/5958" rel="noopener" target="_blank">DNS autoritativo</a>. </p>
<p>Vamos criar um cenário fictício para ilustrar melhor. Temos 1 clientes recebendo IPs privados da classe de um CGNAT, e o mesmo solicita um redirecionamento de portas para seu DVR. O cliente recebe o endereço IP privado 100.64.0.71 (Fixado) seu DVR esta na porta 80 na rede local 192.168.0.7. Para cada situação irei criar um novo subdomínio, exemplo &#8220;dvrudi&#8221; no servidor DNS autoritativo apontando para o IP Público do seu servidor Nginx Proxy, assim eu acesso <em>&#8220;dvrudi.remontti.com.br&#8221;</em>. Agora ao acessar o roteato e criar o redirecionamento provavelmente não iremos poder usar a porta 80, pois ela já é a porta de acesso do roteador 100.64.0.71, e é bem possível que você tenha fechado ela em seu firewall também para se proteger de ataques, neste caso use outra porta exemplos 60080 para fazer o direcionamento para a porta 80 do DVR, o cliente nem precisa saber desta porta 60080 ela é a penas a porta de entrada do Nginx Proxy. Agora volte ao Admin do NPM, no menu <strong>Hosts</strong> >> <strong>Proxy Hosts</strong> >> <strong>Add Proxy Host</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a.png" alt="" width="1256" height="593" class="alignnone size-full wp-image-6571" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a.png 1256w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a-1024x483.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a-768x363.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a-520x245.png 520w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_4_a-720x340.png 720w" sizes="auto, (max-width: 1256px) 100vw, 1256px" /></p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_6.png" alt="" width="1257" height="449" class="alignnone size-full wp-image-6577" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_6.png 1257w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_6-300x107.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_6-1024x366.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_6-768x274.png 768w" sizes="auto, (max-width: 1257px) 100vw, 1257px" /></p>
<p>Se desejar pode ativar certificado grátis com Lets Encrypt.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_5_a.png" alt="" width="1253" height="595" class="alignnone size-full wp-image-6572" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_5_a.png 1253w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_5_a-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_5_a-1024x486.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager_5_a-768x365.png 768w" sizes="auto, (max-width: 1253px) 100vw, 1253px" /></p>
<p>Agora ao acessar <em>&#8220;dvrudi.remontti.com.br&#8221;</em> ele estará acessando diretamente o DVR. #clientefeliz</p>
<p>Legal não? Agora você pode ter um painel administrativo para redirecionamento de serviços web, no exemplo sitei o caso de CGNAT, mas você pode usar para qualquer outra situação, bem como até apontar para um subdiretório, e restringir o acesso do mesmo, sabe esses ERP <del datetime="2022-06-18T18:45:32+00:00">porco</del> que você acessar com /admin, daria para restringir. Bom o painel do NPM é bem intuitivo, para quem já conhece o Nginx sabe das suas enumeras possibilidades vai achar um doce.</p>
<h4>Atualizando do NPM</h4>
<pre class="remontti-code"># cd /etc/nginx-proxy/
# docker-compose down
# docker-compose pull
# docker-compose up -d</pre>
<p><strong>Gostou? Se quiser apoiar o blog e fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/06/nginx_proxy_manager.png" alt="" width="261" height="90" class="alignnone size-full wp-image-6583" /><br />
<strong>Fonte: </strong><br />
<a href="https://nginxproxymanager.com/guide/" rel="noopener" target="_blank">https://nginxproxymanager.com/guide/</a><br />
<a href="https://github.com/NginxProxyManager/nginx-proxy-manager" rel="noopener" target="_blank">https://github.com/NginxProxyManager/nginx-proxy-manager</a></p>
<p>O post <a href="https://blog.remontti.com.br/6561">Instalação do Nginx Proxy Manager</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/6561/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Aprenda instalar o Jitsi Meet, uma ferramenta de videoconferências de código aberto</title>
		<link>https://blog.remontti.com.br/6432</link>
					<comments>https://blog.remontti.com.br/6432#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Fri, 25 Mar 2022 19:16:55 +0000</pubDate>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google meet]]></category>
		<category><![CDATA[jitsi]]></category>
		<category><![CDATA[letsencrypt]]></category>
		<category><![CDATA[meet]]></category>
		<category><![CDATA[meeting]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[videoconferências]]></category>
		<category><![CDATA[zoom]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=6432</guid>

					<description><![CDATA[<p>Que tal ter o seu próprio &#8220;Zoom ou Google Meet&#8221;? Neste tutorial vamos aprender instalar o Jitsi Meet de forma simples para você poder criar seu próprio servidor de videoconferências. Jitsi é uma coleção&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/6432">Aprenda instalar o Jitsi Meet, uma ferramenta de videoconferências de código aberto</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Que tal ter o seu próprio &#8220;Zoom ou Google Meet&#8221;? Neste tutorial vamos aprender instalar o Jitsi Meet de forma simples para você poder criar seu próprio servidor de videoconferências.</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/jitsi-debian.png" alt="" width="720" height="340" class="alignnone size-full wp-image-6467" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/jitsi-debian.png 720w, https://blog.remontti.com.br/wp-content/uploads/2022/03/jitsi-debian-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/jitsi-debian-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /></p>
<p><strong><a href="https://meet.jit.si/" rel="noopener" target="_blank">Jitsi</a></strong> é uma coleção de projetos de <a href="https://github.com/jitsi/handbook" rel="noopener" target="_blank">código aberto</a> que fornecem recursos de videoconferência de última geração que são seguros, fáceis de usar e fáceis de hospedar.</p>
<h3>Requerimentos</h3>
<p>Debian 11 (Bullseye) 64 bits <strong><a href="https://blog.remontti.com.br/5792" rel="noopener" target="_blank">instalação mínima</a></strong> pronta<br />
Configurado em seu <a href="https://blog.remontti.com.br/5958" rel="noopener" target="_blank"><strong>DNS</strong> autoritativo</a> um <strong>subdomínio</strong> exemplo &#8220;<em>meet.remontti.com.br</em>&#8221; apontado para o IPv4/6 do seu servidor.</p>
<h3>Ajustes</h3>
<p>Tenha seu servidor atualizado! <em>(E repita isso uma vez por mês após)</em></p>
<pre class="remontti-code"># apt update; apt upgrade</pre>
<p>Nesta instalação estarei utilizando como exemplo &#8220;meet.remontti.com.br&#8221;, ajuste sempre pelo seu. </p>
<p>Ajuste o nome do servidor:</p>
<pre class="remontti-code">hostnamectl set-hostname meet.remontti.com.br</pre>
<pre class="remontti-code">vim /etc/hosts</pre>
<p>Adicione o IP Domínio de acordo com seu DNS, exemplo:</p>
<pre class="remontti-code-plain">255.200.200.200 meet.remontti.com.br</pre>
<p>Caso esteja utilizando um IP com NAT terá que ter as portas 80/tcp 443/tcp 4443/tcp 10000/udp 3478/udp 5349/tcp abertas/redirecionadas para o IP do seu servidor.</p>
<p>Instale alguns pacotes básicos que serão necessários:</p>
<pre class="remontti-code"># apt install apt-transport-https gnupg2 curl wget</pre>
<h3>Instalando Jitsi</h3>
<p>Vamos adicionar o repositório oficial do jitsi (stable)</p>
<pre class="remontti-code"># echo &#039;deb https://download.jitsi.org stable/&#039; &gt; /etc/apt/sources.list.d/jitsi-stable.list 
# wget -qO - https://download.jitsi.org/jitsi-key.gpg.key  | apt-key add - </pre>
<p>Instale o mesmo</p>
<pre class="remontti-code"># apt update
# apt install jitsi-meet</pre>
<p>Informe seu domíno:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_1.png" alt="" width="1107" height="482" class="alignnone size-full wp-image-6433" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_1.png 1107w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_1-300x131.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_1-1024x446.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_1-768x334.png 768w" sizes="auto, (max-width: 1107px) 100vw, 1107px" /><br />
Selecione <em>Generate a net self-signed certificate</em><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_2.png" alt="" width="1880" height="533" class="alignnone size-full wp-image-6434" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_2.png 1880w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_2-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_2-1024x290.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_2-768x218.png 768w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_2-1536x435.png 1536w" sizes="auto, (max-width: 1880px) 100vw, 1880px" /><br />
Agora instale o certbot para gerar os certificados com lets encript.</p>
<pre class="remontti-code"># apt install certbot</pre>
<p>Gere um certificado Let&#8217;s Encrypt, basta executar:</p>
<pre class="remontti-code">/usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh</pre>
<pre class="remontti-code-plain">-------------------------------------------------------------------------
This script will:
- Need a working DNS record pointing to this machine(for domain meet.remontti.com.br)
- Download certbot-auto from https://dl.eff.org to /usr/local/sbin
- Install additional dependencies in order to request Let’s Encrypt certificate
- If running with jetty serving web content, will stop Jitsi Videobridge
- Configure and reload nginx or apache2, whichever is used
- Configure the coturn server to use Let&#039;s Encrypt certificate and add required deploy hooks
- Add command in weekly cron job to renew certificates regularly

You need to agree to the ACME server&#039;s Subscriber Agreement (https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf) 
by providing an email address for important account notifications
Enter your email and press [ENTER]: noc@remontti.com.br
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Account registered.
Requesting a certificate for meet.remontti.com.br
Performing the following challenges:
http-01 challenge for meet.remontti.com.br
Using the webroot path /usr/share/jitsi-meet for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Running deploy-hook command: /etc/letsencrypt/renewal-hooks/deploy/0000-coturn-certbot-deploy.sh
Output from deploy-hook command 0000-coturn-certbot-deploy.sh:
Configuring turnserver


IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/meet.remontti.com.br/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/meet.remontti.com.br/privkey.pem
   Your certificate will expire on 2022-06-22. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again. To non-interactively renew *all* of your
   certificates, run &quot;certbot renew&quot;
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let&#039;s Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Configuring nginx</pre>
<p>Crie um scrip para renovação do certificado</p>
<pre class="remontti-code"># mkdir /root/scripts/
# vim /root/scripts/renova-certificado</pre>
<pre class="remontti-code-plain">
#!/bin/bash
# Pare o serviço web
/usr/bin/systemctl stop nginx
# Aguarda 10 seg
sleep 10
# Renova o certificado
/usr/bin/certbot renew -q
# Aguarda o certificado renovar
sleep 30
# Inicie o serviço web
/usr/bin/systemctl restart nginx
# Reinicie os serviços
/usr/bin/systemctl systemctl restart prosody jicofo jitsi-videobridge2</pre>
<p>Adicione ao cron para ser executado umas vez por semana toda às 3h.</p>
<pre class="remontti-code"># chmod +x /root/scripts/renova-certificado
# echo &#039;00 30   1 * *   root    /root/scripts/renova-certificado&#039; &gt;&gt; /etc/crontab</pre>
<p>Reinicie o cron para ler a nova tarefa.</p>
<pre class="remontti-code"># systemctl restart cron</pre>
<p>Systemd/Limits: As implantações padrão em sistemas que usam systemd terão valores padrão baixos para processos máximos e arquivos abertos. Se a ponte usada espera um número maior de participantes, os valores padrão precisam ser ajustados (os valores padrão são bons para menos de 100 participantes).<br />
Se achar necessário aumente estes valores:</p>
<pre class="remontti-code"># echo &#039;DefaultLimitNOFILE=65000&#039; &gt;&gt; /etc/systemd/system.conf
# echo &#039;DefaultLimitNPROC=65000&#039; &gt;&gt; /etc/systemd/system.conf
# echo &#039;DefaultTasksMax=65000&#039; &gt;&gt; /etc/systemd/system.conf</pre>
<p>Reinicie o daemon</p>
<pre class="remontti-code"># systemctl daemon-reload</pre>
<p>Verifique se os valores foram alterados</p>
<pre class="remontti-code"># systemctl show --property DefaultLimitNPROC
# systemctl show --property DefaultLimitNOFILE
# systemctl show --property DefaultTasksMax</pre>
<p>Reinicie o jitsi</p>
<pre class="remontti-code"># systemctl status jitsi-videobridge2</pre>
<pre class="remontti-code"># cat /proc/`cat /var/run/jitsi-videobridge/jitsi-videobridge.pid`/limits</pre>
<p>Veja se <em>Max processes</em> e <em>Max open files</em> estão com <em>limit: 65000</em></p>
<pre class="remontti-code-plain">Limit                     Soft Limit           Hard Limit           Units     
...
Max processes             65000                65000                processes
Max open files            65000                65000                files
...
</pre>
<p>Neste momento seu servidor já esta rodando de forma anônima, onde qualquer um pode criar já uma sala de reunião.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11.png" alt="" width="1273" height="858" class="alignnone size-full wp-image-6459" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11.png 1273w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11-300x202.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11-1024x690.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11-768x518.png 768w" sizes="auto, (max-width: 1273px) 100vw, 1273px" /></p>
<p>Porém é possível permitir que apenas usuários autenticados criem novas salas de conferência. Sempre que uma nova sala estiver prestes a ser criada, o Jitsi Meet solicitará um nome de usuário e senha. Depois que a sala for criada, outras pessoas poderão ingressar no domínio anônimo. </p>
<pre class="remontti-code"># vim /etc/prosody/conf.avail/meet.remontti.com.br.cfg.lua</pre>
<p>Localize <strong>authentication</strong> e altere <strong>anonymous</strong> para <strong>internal_hashed</strong>:</p>
<pre class="remontti-code-plain">authentication = &quot;anonymous&quot;</pre>
<p>Para</p>
<pre class="remontti-code-plain">authentication = &quot;internal_hashed&quot;</pre>
<p>Descomente:</p>
<pre class="remontti-code-plain">https_ports = { };</pre>
<p>Ainda no mesmo arquivo adicione as linhas a baixo ante de <em>&#8220;&#8211; Proxy to jicofo&#8217;s user JID&#8230;&#8221;</em><br />
<strong>OBS:</strong> Não é necessário você criar uma entra &#8220;guest.meet&#8221; em seu DNS.</p>
<pre class="remontti-code-plain">VirtualHost &quot;guest.meet.remontti.com.br&quot;
    authentication = &quot;anonymous&quot;
    c2s_require_encryption = false</pre>
<p>Agora em /etc/jitsi/meet/SEUDOMINO-config.js faça:</p>
<pre class="remontti-code"># vim /etc/jitsi/meet/meet.remontti.com.br-config.js</pre>
<p>Localize anonymousdomain, vai estar comentada com &#8220;//&#8221;, remova o comentário e adicione seu &#8220;guest.meet.remontti.com.br&#8221;.</p>
<pre class="remontti-code-plain">// anonymousdomain: &#039;guest.example.com&#039;,</pre>
<p>Ficando</p>
<pre class="remontti-code-plain">anonymousdomain: &#039;guest.meet.remontti.com.br&#039;,</pre>
<p>Em jicofo.conf será necessário fazer os ajustes para autenticação.</p>
<pre class="remontti-code"># vim /etc/jitsi/jicofo/jicofo.conf</pre>
<p>Adicione em <em>jicofo { &#8230; } </em></p>
<pre class="remontti-code-plain">
  authentication: {
    enabled: true
    type: XMPP
    login-url: jitsi-meet.example.com
 }</pre>
<p>Ficando assim:</p>
<pre class="remontti-code-plain">jicofo {
  authentication: {
    enabled: true
    type: XMPP
    login-url: meet.remontti.com.br
 }
  xmpp: {
    client: {
      client-proxy: focus.meet.remontti.com.br
    }
    trusted-domains: [ &quot;recorder.meet.remontti.com.br&quot; ]
  }
  bridge: {
    brewery-jid: &quot;JvbBrewery@internal.auth.meet.remontti.com.br&quot;
  }
}</pre>
<p>Reinicie os serviços</p>
<pre class="remontti-code"># systemctl restart prosody jicofo jitsi-videobridge2</pre>
<p>Agora ao criar uma nova reunião<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_3.png" alt="" width="1228" height="678" class="alignnone size-full wp-image-6444" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_3.png 1228w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_3-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_3-1024x565.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_3-768x424.png 768w" sizes="auto, (max-width: 1228px) 100vw, 1228px" /><br />
Será necessário autenticar:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_4.png" alt="" width="1104" height="558" class="alignnone size-full wp-image-6445" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_4.png 1104w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_4-300x152.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_4-1024x518.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_4-768x388.png 768w" sizes="auto, (max-width: 1104px) 100vw, 1104px" /><br />
Então para criar um usuário (ou mais) administrador faça em seu terminal:</p>
<pre class="remontti-code"># prosodyctl register meuusuario meet.remontti.com.br minhasenha</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_5.png" alt="" width="1158" height="506" class="alignnone size-full wp-image-6446" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_5.png 1158w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_5-300x131.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_5-1024x447.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_5-768x336.png 768w" sizes="auto, (max-width: 1158px) 100vw, 1158px" /><br />
Para deletar um usuário:</p>
<pre class="remontti-code"># prosodyctl deluser meuusuario@meet.remontti.com.br</pre>
<p>Com sua sala de reunião pronta você pode desejar fazer alguns ajustes em mais configurações <strong>[&#8230;]</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_6.png" alt="" width="655" height="110" class="alignnone size-full wp-image-6447" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_6.png 655w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_6-300x50.png 300w" sizes="auto, (max-width: 655px) 100vw, 655px" /><br />
Ajuste seus dados<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_7.png" alt="" width="715" height="771" class="alignnone size-full wp-image-6448" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_7.png 715w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_7-278x300.png 278w" sizes="auto, (max-width: 715px) 100vw, 715px" /><br />
Informe seu nome e e-mail se desejar<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_8.png" alt="" width="861" height="474" class="alignnone size-full wp-image-6449" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_8.png 861w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_8-300x165.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_8-768x423.png 768w" sizes="auto, (max-width: 861px) 100vw, 861px" /><br />
Você pode ainda fazer outros ajustes como:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_9.png" alt="" width="791" height="419" class="alignnone size-full wp-image-6450" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_9.png 791w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_9-300x159.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_9-768x407.png 768w" sizes="auto, (max-width: 791px) 100vw, 791px" /></p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_10.png" alt="" width="815" height="525" class="alignnone size-full wp-image-6451" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_10.png 815w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_10-300x193.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_10-768x495.png 768w" sizes="auto, (max-width: 815px) 100vw, 815px" /><br />
Clique em OK para aplicar.<br />
Outro ajuste que é interessante são as opções de segurança:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_11.png" alt="" width="883" height="756" class="alignnone size-full wp-image-6453" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_11.png 883w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_11-300x257.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_11-768x658.png 768w" sizes="auto, (max-width: 883px) 100vw, 883px" /><br />
É interessante você Habilitar sala de espera, assim novos usuários terão que informar seu nome e você precisará aprovar sua entrada.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_12.png" alt="" width="907" height="615" class="alignnone size-full wp-image-6454" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_12.png 907w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_12-300x203.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_12-768x521.png 768w" sizes="auto, (max-width: 907px) 100vw, 907px" /><br />
Agora quando alguém entrar na sala ira aparecer a seguinte tela:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_13.png" alt="" width="1057" height="534" class="alignnone size-full wp-image-6455" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_13.png 1057w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_13-300x152.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_13-1024x517.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_13-768x388.png 768w" sizes="auto, (max-width: 1057px) 100vw, 1057px" /><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_14.png" alt="" width="1057" height="534" class="alignnone size-full wp-image-6456" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_14.png 1057w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_14-300x152.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_14-1024x517.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_14-768x388.png 768w" sizes="auto, (max-width: 1057px) 100vw, 1057px" /><br />
O administrador ira autoriza-lo:<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_15.png" alt="" width="1063" height="565" class="alignnone size-full wp-image-6457" srcset="https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_15.png 1063w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_15-300x159.png 300w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_15-1024x544.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2022/03/Jitsi_Debian_11_15-768x408.png 768w" sizes="auto, (max-width: 1063px) 100vw, 1063px" /></p>
<p>Bom a interface é bem intuitiva então acredito que não terá dificuldas. E não deixe de ler as <a href="https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-web-integrations" rel="noopener" target="_blank">integrações</a>, bem como o restante da documentação, pois o projeto tem muita coisa que não foi mostrada aqui.</p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fonte:</strong> <a href="https://jitsi.github.io/handbook/docs/intro" rel="noopener" target="_blank">https://jitsi.github.io/handbook/docs/intro</a></p>
<p>O post <a href="https://blog.remontti.com.br/6432">Aprenda instalar o Jitsi Meet, uma ferramenta de videoconferências de código aberto</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/6432/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 11 Bullseye (LNPP)</title>
		<link>https://blog.remontti.com.br/5915</link>
					<comments>https://blog.remontti.com.br/5915#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 20 Oct 2021 18:45:33 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[7.4]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Bullseye]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 11]]></category>
		<category><![CDATA[lnpp]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php7]]></category>
		<category><![CDATA[postgresql]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5915</guid>

					<description><![CDATA[<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5915">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 11 Bullseye (LNPP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/NGINX-LNNP_DEB_11.png" alt="" width="720" height="340" class="alignnone size-full wp-image-5927" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/NGINX-LNNP_DEB_11.png 720w, https://blog.remontti.com.br/wp-content/uploads/2021/10/NGINX-LNNP_DEB_11-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/NGINX-LNNP_DEB_11-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /><br />
Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor performance. O Apache, sem dúvidas, é o servidor web mais popular. No entanto, o NGINX a cada ano ganha mais popularidade e está sendo a preferência dos novos projetos. Também estarei instalando o banco de dados PostgreSQL e phpPgAdmin como gerenciador web. </p>
<p>Distribuição utilizada: <strong><a href="https://blog.remontti.com.br/5792" rel="noopener noreferrer" target="_blank">Debian 11 Bullseye / Instalação Limpa</a></strong></p>
<h3>NGINX 1.18</h3>
<p><a href="https://www.nginx.com" rel="noopener" target="_blank">https://www.nginx.com</a></p>
<pre class="remontti-code"># apt install nginx</pre>
<p>Acesse agora em seu navegador http://IP-SERVIDOR/<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png" alt="" width="1100" height="310" class="alignnone size-full wp-image-5467" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png 1100w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-1024x289.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-768x216.png 768w" sizes="auto, (max-width: 1100px) 100vw, 1100px" /><br />
Se você acessar um diretório que não existe um erro dizendo que não existe, e junto informações que não é legal aparecer.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png" alt="" width="1036" height="296" class="alignnone size-full wp-image-5468" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png 1036w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-300x86.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-1024x293.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-768x219.png 768w" sizes="auto, (max-width: 1036px) 100vw, 1036px" /><br />
Vamos remover assinatura do nginx onde ele exibe a versão do mesmo. Ninguém precisa saber! Correto?</p>
<pre class="remontti-code"># sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png" alt="" width="712" height="157" class="alignnone size-full wp-image-5469" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png 712w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3-300x66.png 300w" sizes="auto, (max-width: 712px) 100vw, 712px" /></p>
<p>Pronto nosso NGINX está rodando! </p>
<h3>PostgreSQL</h3>
<pre class="remontti-code"># apt install postgresql postgresql-contrib</pre>
<p>Torne-se o usuário postgres, para poder criar o banco de dados.</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Execute para entrar no terminal de comandos do banco.</p>
<pre class="remontti-code">$ psql</pre>
<p>Para definir a senha do usuário postgres e instalar o adminpack.</p>
<pre class="remontti-code">postgres=# \password postgres
Digite nova senha para postgres: 
Digite-a novamente:
postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION
postgres=# \q 
$ exit</pre>
<p>Ajustes no pg_hba.conf, assim toda alteração será necessaria validação do postgres com a senha que acabou de definir.</p>
<pre class="remontti-code"># vim /etc/postgresql/13/main/pg_hba.conf</pre>
<p>Altere as seguintes linhas: </p>
<pre class="remontti-code">local   all             postgres                                peer
local   all             all                                     peer</pre>
<p>Para:</p>
<pre class="remontti-code">local   all             postgres                                md5
local   all             all                                     md5</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png" alt="" width="1010" height="268" class="alignnone size-full wp-image-5501" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png 1010w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-300x80.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-768x204.png 768w" sizes="auto, (max-width: 1010px) 100vw, 1010px" /><br />
Reinicie o postgres</p>
<pre class="remontti-code"># systemctl restart postgresql</pre>
<p>Volte para o postgres</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Agora para toda ação será necessário autenticar.</p>
<pre class="remontti-code">$ psql 
Senha para usuário postgres: !!SUA_SENHA!!
psql (13.4 (Debian 13.4-0+deb11u1))
Type &quot;help&quot; for help.
postgres-# \q</pre>
<p>Para demonstração irei criar um banco/usuário teste, não esqueça de alterar a senha.</p>
<pre class="remontti-code">$ createuser --pwprompt teste
Digite a senha para a nova role: &lt;&lt; NOVA SENHA PARA O USUÁRIO TESTE
Digite-a novamente: &lt;&lt; REPITA
Senha: &lt;&lt; SENHA DO QUE SETOU ANTES  NO COMANDO &quot;\password postgres&quot;</pre>
<p>Agora crie o  banco e vincule ao usuário.</p>
<pre class="remontti-code">$ createdb -O teste meubd
Senha: &lt;&lt;&lt; SENHA DO POSTGRES </pre>
<p>Verifique se o mesmo foi criado.</p>
<pre class="remontti-code">$ psql -l 
Senha para usuário postgres: 
                               Lista dos bancos de dados
   Nome    |   Dono   | Codificação |   Collate   |    Ctype    | Privilégios de acesso 
-----------+----------+-------------+-------------+-------------+-----------------------
 meubd     | teste    | UTF8        | pt_BR.UTF-8 | pt_BR.UTF-8 | 
....
....</pre>
<p>Acessamos agora o bd teste.</p>
<pre class="remontti-code">$ psql -U teste -d meubd
Senha para usuário postgres: 
psql (11.11 (Debian 11.11-0+deb10u1))
Digite &quot;help&quot; para ajuda.

meubd=&gt;</pre>
<p>Vamos fazer uma "brincadeira" só para testar, criaremos uma tabela e inseriremos dados nela.</p>
<pre class="remontti-code">meubd=&gt; CREATE TABLE doacao ( id int,nome text, valor text );
meubd=&gt; INSERT INTO doacao (id,nome,valor) values (1,&#039;Rudimar Remontti&#039;,&#039;R$ 5,00&#039;); 
meubd=&gt; SELECT * FROM doacao;

 id |       nome       |  valor  
----+------------------+---------
  1 | Rudimar Remontti | R$ 5,00

meubd=&gt; \q</pre>
<p>Se deseja remover o banco/usuário teste.</p>
<pre class="remontti-code">$ dropdb meubd
Senha: &lt;&lt; SENHA DO POSTGRES
$ dropuser teste
Senha: &lt;&lt; SENHA DO POSTGRES</pre>
<p>Volte para root</p>
<pre class="remontti-code">$ exit</pre>
<h3>PHP 7.4</h3>
<p>Incluirei algumas extensões do PHP que são normalmente utilizada também na instalação.</p>
<pre class="remontti-code"># apt install php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}</pre>
<p>Agora vamos fazer a "integração" do PHP com o NGINX. Moveremos o arquivo defaul.</p>
<pre class="remontti-code"># mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original</pre>
<p>Crie um novo:</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Ajuste:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}</pre>
<p>Teste a configuração se não tem nada errado e restart os serviços:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx php7.4-fpm</pre>
<p>Vamos criar um arquivo em PHP para testa se nosso NGINX está interpretando o PHP.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo();&#039; &gt;&gt; /var/www/html/teste.php</pre>
<p>Acesse em seu navegador <strong>http://IP-SERVIDOR/teste.php</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/php7.4_nginx.png" data-rel="lightbox-gallery-MTQrUIK6" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/php7.4_nginx-300x279.png" alt="" width="300" height="279" class="alignnone size-medium wp-image-5921" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/php7.4_nginx-300x279.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/php7.4_nginx-768x713.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/php7.4_nginx.png 958w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Nosso servidor WEB com PHP está funcionando! </p>
<p>Exemplo para multiplos domínios/subdomínios </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub1.conf</pre>
<p>Neste ex: vou representar o <em>sub1.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub1;
    index index.php index.html index.htm;

    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;

    server_name sub1.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub2e3.conf</pre>
<p>Neste ex: vou representar o <em>sub2.remontti.com.br</em> e <em>sub3.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name sub2.remontti.com.br sub3.remontti.com.br;

    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}</pre>
<p>Link os arquivos no diretório "/etc/nginx/sites-available"  que será carregado as novas configurações </p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/sub1.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/sub2e3.conf /etc/nginx/sites-enabled/</pre>
<p>Crie os diretórios referente a cada <strong>server_name</strong>.</p>
<pre class="remontti-code"># mkdir /var/www/sub1
# mkdir /var/www/sub2e3
# echo &#039;&lt;?php echo &quot;Olá mundo do sub1!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub1/index.php
# echo &#039;&lt;?php echo &quot;Olá mundo do sub2e3!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub2e3/index.php
</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h3>phpPgAdmin</h3>
<p>O phppgadmin finalmente foiu atualizado para uma versão recente no repositório então iremos insta-lo via apt.</p>
<pre class="remontti-code"># apt install phppgadmin </pre>
<p>Ajustes no config.inc.php</p>
<pre class="remontti-code"># vim /usr/share/phppgadmin/conf/config.inc.php</pre>
<p>Localize as linhas e ajuste:</p>
<pre class="remontti-code">$conf[&#039;extra_login_security&#039;] = false;
$conf[&#039;owned_only&#039;] = true;</pre>
<p>Para torna-lo acessível altere o arquivo de configuração do seu NGINX, no exemplo vou colocar no arquivo default, mas você poderia estar configurando em seus domínios. </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Adicione as linhas destacadas:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ^~ /phppgadmin {
        root /usr/share;
        try_files $uri $uri/ =404;

        #allow  192.168.87.0/24;
        #allow  2001:0db8::/32;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;

        location ~ .php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }

    }

}</pre>
<p>Se deseja tonar o phppgadmin acessível apenas de alguns endereços IPs (RECOMENDO) basta descomentar as linhas, e incluir seus prefixos. O error_page é para que quando a o acessante levar um proibido seja direcionado para um site.</p>
<pre class="remontti-code">allow  192.168.87.0/24;
allow  2001:0db8::/32;
deny   all;
error_page  403   http://www.remontti.com.br;</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<p>Basta acessar <strong>http://IP-SERVIDOR/phppgadmin</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/phppgadmin.png" data-rel="lightbox-gallery-MTQrUIK6" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/phppgadmin-300x144.png" alt="" width="300" height="144" class="alignnone size-medium wp-image-5925" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/phppgadmin-300x144.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phppgadmin-768x369.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phppgadmin.png 955w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<h3>:: Let's Encrypt ::</h3>
<p>Criando certificado grátis para seus sub/domínios.</p>
<pre class="remontti-code"># apt install certbot python3-certbot-nginx</pre>
<p>Para gerar o certificado use o comando:</p>
<pre class="remontti-code"># certbot</pre>
<p>Não esqueça de colocar no seu cron para ele renovar o certificado, pois a cada 90 ele expira. Neste exemplo todo dia primeiro tento renovar.</p>
<pre class="remontti-code"># certbot -q renew</pre>
<p>Dica, se desejar desativar o TLS1.0 e TLS1.1 após criar um certificado um arquivo é criado /etc/letsencrypt/options-ssl-apache.conf, então edite e inclua no SSLProtocol TLSv1 -TLSv1.1</p>
<pre class="remontti-code"># vim /etc/letsencrypt/options-ssl-nginx.conf</pre>
<p>Ficando</p>
<pre class="remontti-code">#ssl_protocols            all -SSLv2 -SSLv3
ssl_protocols             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1</pre>
<p>Reinicie o Neginx:</p>
<pre class="remontti-code"># systemctl restart nginx</pre>
<p>Para testar acesse: <a href="https://www.cdn77.com/tls-test/" rel="noopener" target="_blank">https://www.cdn77.com/tls-test/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png" data-rel="lightbox-gallery-MTQrUIK6" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png" alt="" width="300" height="182" class="alignnone size-medium wp-image-6158" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-1024x620.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-768x465.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png 1099w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fontes:</strong> <a href="https://docs.nginx.com/" rel="noopener" target="_blank">https://docs.nginx.com/</a><br />
<a href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/" rel="noopener" target="_blank">https://docs.nginx.com/nginx/admin-guide/web-server/web-server/</a></p>
<p>O post <a href="https://blog.remontti.com.br/5915">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 11 Bullseye (LNPP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5915/feed</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Instalação do Zabbix 5 LTS + Grafana 7/8 + NGINX + PostgreSQL + Notificação Telegram com Debian 10/11</title>
		<link>https://blog.remontti.com.br/5517</link>
					<comments>https://blog.remontti.com.br/5517#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Fri, 16 Apr 2021 20:08:16 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Bullseye]]></category>
		<category><![CDATA[buster]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 11]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[telegram]]></category>
		<category><![CDATA[zabbix]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5517</guid>

					<description><![CDATA[<p>O Zabbix é uma solução de nível enterprise, de código aberto. O Zabbix é um software que monitora vários parâmetros da rede, dos servidores e da saúde dos serviços. Utiliza-se de um mecanismo flexível&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5517">Instalação do Zabbix 5 LTS + Grafana 7/8 + NGINX + PostgreSQL + Notificação Telegram com Debian 10/11</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL.png" alt="" width="720" height="340" class="alignnone size-full wp-image-5530" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL.png 720w, https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /><br />
O <strong>Zabbix</strong> é uma solução de nível enterprise, de código aberto. O Zabbix é um software que monitora vários parâmetros da rede, dos servidores e da saúde dos serviços. Utiliza-se de um mecanismo flexível de notificação que permite configurar alertas por e-mail entre outros como Telegram, para praticamente qualquer evento. As notificações permitem que se reaja rapidamente à problemas no ambiente. O Zabbix oferece excelentes recursos de relatórios e visualização de dados armazenados. Isso faz com que o Zabbix seja a ferramenta ideal para planejamento de capacidade.<br />
O <strong>Grafana</strong> é um software livre que permite a visualização de formato de dados métricos. Ele permite criar painéis e gráficos a partir de várias fontes, mas aqui iremos vamos aprender a integra-lo com o Zabbix.</p>
<h4>Requisitos se Debian 10 Buster</h4>
<p>&#8211; <a href="https://blog.remontti.com.br/2966" rel="noopener noreferrer" target="_blank">* Debian 10 instalação limpa</a><br />
&#8211; <a href="https://blog.remontti.com.br/5487" rel="noopener" target="_blank">* Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt</a> (Opcional phpPgAdmin + Letsencrypt)</p>
<h4>Requisitos se Debian 11 Bullseye </h4>
<p>&#8211; <a href="https://blog.remontti.com.br/5792" rel="noopener" target="_blank">Instalação do Debian 11 Bullseye limpa passo-a-passo</a><br />
&#8211; <a href="https://blog.remontti.com.br/5915" rel="noopener" target="_blank">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 11 Bullseye (LNPP)</a></p>
<h1>Instalação do Zabbix</h1>
<p>Para instalação do Zabbix vamos incluir o repositório do oficial do Zabbix.</p>
<pre class="remontti-code"># su -
# cd /tmp
# apt install wget</pre>
<p><strong>Repositório Debian 10</strong></p>
<pre class="remontti-code"># wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
# dpkg -i zabbix-release_5.0-1+buster_all.deb</pre>
<p><strong>Repositório  Debian 11</strong></p>
<pre class="remontti-code"># wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-2+debian11_all.deb
# dpkg -i zabbix-release_5.0-2+debian11_all.deb</pre>
<p>Atualize o repositório e realize a instalação </p>
<pre class="remontti-code"># apt update ; apt upgrade
# apt install zabbix-server-pgsql zabbix-frontend-php zabbix-nginx-conf zabbix-agent</pre>
<p>Vamos criar uma base de dados chamada <strong>zabbix</strong> e um usuário também chamado de zabbix no PostgreSQL.<br />
Não esqueça de alterar a senha: Use o gerador de senha: <a href="https://senhasegura.remontti.com.br/" rel="noopener noreferrer" target="_blank">https://senhasegura.remontti.com.br/</a></p>
<pre class="remontti-code"># su - postgres
$ createuser --pwprompt zabbix
Digite a senha para a nova role:  &lt;SENHA ZABBIX&gt;
Digite-a novamente: &lt;SENHA ZABBIX&gt;
Senha: &lt;SENHA POSTGRES CASO TENHA DEFINIDO NA INSTALAÇÃO DO MESMO&gt;

$ createdb -O zabbix zabbix
Senha: &lt;SENHA POSTGRES&gt;</pre>
<p>Importe o esquema inicial e os dados. Você será solicitado a inserir a senha que foi criada anteriormente.</p>
<pre class="remontti-code">$ zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | psql -U zabbix -d zabbix &amp;&gt;/dev/null
Senha para usuário zabbix: : &lt;SENHA ZABBIX&gt;
$ exit</pre>
<p>Edite o arquivo zabbix_server.conf para informar os dados para conexão com do PostgreSQL.</p>
<pre class="remontti-code"># vim /etc/zabbix/zabbix_server.conf</pre>
<p>Procure por <strong># DBPassword=</strong> descomente e sete sua senha.</p>
<pre class="remontti-code">#...
DBPassword=&lt;SENHA ZABBIX&gt;
#...</pre>
<p>Ajuste o arquivo /etc/zabbix/php-fpm.conf, descomente e defina o fuso horário correto. <a href="https://secure.php.net/manual/pt_BR/timezones.america.php" rel="noopener noreferrer" target="_blank">timezone</a> Sua região</a>.</p>
<pre class="remontti-code"># vim /etc/zabbix/php-fpm.conf</pre>
<p>Exemplo:</p>
<pre class="remontti-code">; php_value[date.timezone] = Europe/Riga
php_value[date.timezone] = America/Sao_Paulo</pre>
<p>Este é modelo padrão, altere então para sua região, também irei alterar alguns valores padrões se quiser pode remover as conf do mod_php5.c </p>
<p>Ajuste as configurações do nginx.</p>
<pre class="remontti-code"># vim /etc/nginx/conf.d/zabbix.conf </pre>
<p>Deixei algumas linhas comentadas como exemplo, faça de acordo com sua necessidade.</p>
<pre class="remontti-code">server {
        listen 80;
        listen [::]:80;
        server_name    zabbix.remontti.com.br localhost;
        #server_name   OU_SEU_IP;

        # Metodo simples para quem quer rodar em uma determinada porta
        #listen 8181;
        #listen [::]:8181;
        #server_name     _;

        root    /usr/share/zabbix;
        index   index.php;

        # Desmomente para deixar restringido apenas para determinados prefixos
        #allow  192.168.87.0/24;
        #allow  127.0.0.1;
        #allow  2001:0db8::/32;
        #allow  ::1;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;
 
        location = /favicon.ico {
                log_not_found   off;
        }

        location / {
                try_files       $uri $uri/ =404;
        }

        location /assets {
                access_log      off;
                expires         10d;
        }

        location ~ /\.ht {
                deny            all;
        }

        location ~ /(api\/|conf[^\.]|include|locale) {
                deny            all;
                return          404;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_pass    unix:/var/run/php/zabbix.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index   index.php;

                fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
                fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
                fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

                include fastcgi_params;
                fastcgi_param   QUERY_STRING    $query_string;
                fastcgi_param   REQUEST_METHOD  $request_method;
                fastcgi_param   CONTENT_TYPE    $content_type;
                fastcgi_param   CONTENT_LENGTH  $content_length;

                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout         60;
                fastcgi_send_timeout            180;
                fastcgi_read_timeout            180;
                fastcgi_buffer_size             128k;
                fastcgi_buffers                 4 256k;
                fastcgi_busy_buffers_size       256k;
                fastcgi_temp_file_write_size    256k;
        }
}
</pre>
<p>Inicie o servidor Zabbix e os processos do agente e configure-os para que sejam iniciados durante o boot do sistema.</p>
<pre class="remontti-code"># systemctl enable zabbix-server zabbix-agent</pre>
<p><strong>Debian 10</strong></p>
<pre class="remontti-code"># systemctl restart zabbix-server zabbix-agent nginx php7.3-fpm</pre>
<p><strong>Debian 11</strong></p>
<pre class="remontti-code"># systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm</pre>
<p>Acesse em seu navegador <strong>http://seu_ip:porta</strong> ou <strong>http://zabbix.seudominio.com.br</strong></p>
<p><strong>Next Step</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/1.png" alt="" width="1325" height="698" class="alignnone size-full wp-image-5519" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/1.png 1325w, https://blog.remontti.com.br/wp-content/uploads/2021/04/1-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/1-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/1-768x405.png 768w" sizes="auto, (max-width: 1325px) 100vw, 1325px" /></p>
<p>Se tudo estiver ok: <strong>Next step</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2.png" alt="" width="1213" height="1224" class="aligncenter size-full wp-image-4359" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2.png 1213w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-297x300.png 297w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-1015x1024.png 1015w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-150x150.png 150w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-768x775.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-80x80.png 80w" sizes="auto, (max-width: 1213px) 100vw, 1213px" /></a></p>
<p>Selecione <strong>PostgreSQL</strong> e informe a <strong>senha do usuário zabbix </strong>criada anteriormente, clique em <strong>Next step</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/3.png" alt="" width="1325" height="698" class="alignnone size-full wp-image-5520" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/3.png 1325w, https://blog.remontti.com.br/wp-content/uploads/2021/04/3-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/3-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/3-768x405.png 768w" sizes="auto, (max-width: 1325px) 100vw, 1325px" /></p>
<p><strong>Next step</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4.png" alt="" width="1220" height="685" class="aligncenter size-full wp-image-4361" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4.png 1220w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4-300x168.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4-1024x575.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4-768x431.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></a></p>
<p><strong>Next step</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/5.png" alt="" width="1325" height="698" class="alignnone size-full wp-image-5521" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/5.png 1325w, https://blog.remontti.com.br/wp-content/uploads/2021/04/5-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/5-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/5-768x405.png 768w" sizes="auto, (max-width: 1325px) 100vw, 1325px" /></p>
<p><strong>Finish</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6.png" alt="" width="1220" height="685" class="aligncenter size-full wp-image-4363" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6.png 1220w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6-300x168.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6-1024x575.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6-768x431.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></a></p>
<p>Entre com Usuário <strong>Admin</strong> e senha <strong>zabbix</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7.png" alt="" width="1220" height="685" class="aligncenter size-full wp-image-4364" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7.png 1220w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7-300x168.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7-1024x575.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7-768x431.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></a></p>
<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8.png" alt="" width="1401" height="1137" class="aligncenter size-full wp-image-4365" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8.png 1401w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8-300x243.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8-1024x831.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8-768x623.png 768w" sizes="auto, (max-width: 1401px) 100vw, 1401px" /></a></p>
<p>Para dexa-lo em Português / Tema escuro:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4388" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<hr>
<p><strong><font color="red">Possível bug na instalação</font></strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX.jpg" alt="" width="1264" height="446" class="alignnone size-full wp-image-5704" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX.jpg 1264w, https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX-300x106.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX-1024x361.jpg 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX-768x271.jpg 768w" sizes="auto, (max-width: 1264px) 100vw, 1264px" /><br />
Caso se deparar com essa tela não se assuste, faça o seguinte:</p>
<pre class="remontti-code"># touch /etc/zabbix/web/zabbix.conf.php
# chown www-data. /etc/zabbix/web/zabbix.conf.php</pre>
<p>De um [Back]  depois [Next] q é sucesso!</p>
<hr>
<h1>Alertas no Telegram</h1>
<p>No Zabbix 5 temos o Telegram/Webhook, então bora aprender mexer nisso! Mas antes de mais nada será necessário criarmos um bot no Telegram.</p>
<p><strong>Criando Bot no telegram</strong></p>
<p>Abra o Telegram e procure por <a href="https://t.me/BotFather" rel="noopener noreferrer" target="_blank"><strong>@BotFather</strong></a>.<br />
Inicie a conversa com ele.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2823" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2826" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2827" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p>&#8211; Digite o comando <strong>/newbot</strong> para iniciar a criação de um novo bot.<br />
&#8211; Após o comando você vai dar um nome para seu bot. Ex.: <em>&#8220;Bot Legal RR&#8221;</em>.<br />
&#8211; Em seguida é necessário digitar o nome de usuário para o bot, sendo obrigatório terminar com <strong>bot</strong>. Ex.: <em>&#8220;legallrr_bot&#8221;</em>.<br />
&#8211; Ao finalizar você receber informações com seu TOKEN, que vamos utilizar em seguida.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2830" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2833" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2835" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p>Neste exemplo nosso token para acessar a API HTTP ficou:<br />
<strong>757396508:AAHpaoyVN-95maOCax1vDPDQBnSaZd9P5r0</strong></p>
<p>Agora que o token abra o menu <strong>Administração</strong> &#8211;> <strong>Tipos de mídias</strong></p>
<p>Localize o Telegram e clique nele<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1.png" alt="" width="1680" height="968" class="aligncenter size-full wp-image-4386" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-300x173.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-1024x590.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-768x443.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-1536x885.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Edite o ParseMode para HTML e Token para o token q você acabou de criar. Marque Process tags.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2.png" alt="" width="1680" height="885" class="aligncenter size-full wp-image-4387" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-768x405.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-1536x809.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Neste momento que escrevo na própria descrição da mídia telegram ele recomenda você add o bot @myidbot para descobrir o seu ID, mas parace que este bot está &#8220;dormindo&#8221;. Vamos ao metodos tradicional. Você pode receber notificações direta do seu bot ou então adiciono-lo em um grupo. </p>
<p>Procure pelo seu bot e comece uma conversa com ele e envie uma mensagem de teste para o mesmo, pois vamos precisar descobrir o ID do seu usuário, para que ele possa lhe enviar as mensagens.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2837" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2838" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p>Abra em seu seu navegador a seguinte URL <em>https://api.telegram.org/bot<strong>TOKEN</strong>/getUpdates</em> para descobrir o ID do usuário que enviou a mensagem ou de um grupo.<br />
Ex.: <font size="2"><em>https://api.telegram.org/bot<strong><font color="red">757396508:AAHpaoyVN-95maOCax1vDPDQBnSaZd9P5r0</font></strong>/getUpdates</em></font></p>
<p><strong>:: Chat privado ::</strong></p>
<pre class="remontti-code">{&quot;ok&quot;:true,&quot;result&quot;:[{
	&quot;update_id&quot;:649208620,&quot;message&quot;:{
		&quot;message_id&quot;:2,&quot;from&quot;:{&quot;id&quot;:221122111,&quot;is_bot&quot;:false,&quot;first_name&quot;:&quot;Rudimar&quot;,&quot;last_name&quot;:&quot;Remontti&quot;,&quot;username&quot;:&quot;remontti&quot;,&quot;language_code&quot;:&quot;pt-br&quot;},
		&quot;chat&quot;:{&quot;id&quot;:999999999,&quot;first_name&quot;:&quot;Rudimar&quot;,&quot;last_name&quot;:&quot;Remontti&quot;,&quot;username&quot;:&quot;remontti&quot;,&quot;type&quot;:&quot;private&quot;},
		&quot;date&quot;:1541210279,&quot;text&quot;:&quot;Testando&quot;
	}
}]}</pre>
<p>ID do chat privado: <strong>999999999</strong></p>
<p>Se desejar criar um grupo também, basta adicionar seu bot a ele, após adiciona-lo envia uma mensagem como <strong>/teste</strong> para que possamos coletar o ID do grupo.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2843" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10.jpg" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2844" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p><strong>:: Chat em Grupo ::</strong></p>
<pre class="remontti-code">{&quot;ok&quot;:true,&quot;result&quot;:[{
	&quot;update_id&quot;:649208622,&quot;message&quot;:{&quot;message_id&quot;:4,&quot;from&quot;:{
		&quot;id&quot;:221122111,&quot;is_bot&quot;:false,&quot;first_name&quot;:&quot;Rudimar&quot;,&quot;last_name&quot;:&quot;Remontti&quot;,&quot;username&quot;:&quot;remontti&quot;,&quot;language_code&quot;:&quot;pt-br&quot;},
		&quot;chat&quot;:{&quot;id&quot;:-88888888888,&quot;title&quot;:&quot;Grupo Legal&quot;,&quot;type&quot;:&quot;group&quot;,&quot;all_members_are_administrators&quot;:true
	},&quot;date&quot;:1541210975,&quot;text&quot;:&quot;/teste&quot;,&quot;entities&quot;:[{&quot;offset&quot;:0,&quot;length&quot;:6,&quot;type&quot;:&quot;bot_command&quot;}
}]}</pre>
<p>ID do chat grupo: <strong>-88888888888</strong></p>
<p>Atenção para os <strong>grupos</strong> que sempre tem um sinal &#8220;-&#8221; na frente do ID.</p>
<p>Com o ID do grupo/usuário precisamos vincular ao usuário do Zabbix (Neste caso Admin)<br />
<strong>Administração</strong> ⇒ <strong>Usuários</strong> Clique no usuário <strong>Admin</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3.png" alt="" width="1680" height="541" class="aligncenter size-full wp-image-4389" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-300x97.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-1024x330.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-768x247.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-1536x495.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Com as opções do usuário aberto clique na aba <strong>Mídia</strong> em seguita clique no <strong>Adicionar</strong>, selecione o Tipo Telegram e insira o em Enviar para o ID.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5.png" alt="" width="1680" height="624" class="aligncenter size-full wp-image-4390" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-300x111.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-1024x380.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-768x285.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-1536x571.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a> </p>
<p>Atualize<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6.png" alt="" width="1680" height="269" class="aligncenter size-full wp-image-4391" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-300x48.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-1024x164.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-768x123.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-1536x246.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Agora vamos criar a ação que fará o envios dos alertas.<br />
<strong>Configurações</strong> ⇒ <strong>Ações</strong> ⇒ <strong>Criar ação</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7.png" alt="" width="1680" height="495" class="aligncenter size-full wp-image-4392" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-300x88.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-1024x302.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-768x226.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-1536x453.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>De um nome para sua ação<br />
Em Condição clique em adicionar: Selecione <strong>Incidente suprimido</strong> e marque <strong>Não</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8.png" alt="" width="1680" height="527" class="aligncenter size-full wp-image-4393" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-300x94.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-1024x321.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-768x241.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-1536x482.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Na aba <strong>Operações</strong> primeiro item <strong>Operações</strong> clique em <strong>adicionar</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9.png" alt="" width="1680" height="470" class="aligncenter size-full wp-image-4394" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-300x84.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-1024x286.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-768x215.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-1536x430.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p><strong>Enviar para usuário</strong>: Selecione o <strong>Admin</strong><br />
Enviar apenas para: <strong>Telegram</strong><br />
Marque <strong>Custom message</strong>, preencha com:<br />
<strong>Assunto</strong>:</p>
<pre class="remontti-code"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Problema: &lt;b&gt;{HOST.NAME}&lt;/b&gt;</pre>
<p><strong>Mensagem</strong></p>
<pre class="remontti-code">&lt;code&gt;{EVENT.NAME}&lt;/code&gt;
&lt;b&gt;{ITEM.NAME1}&lt;/b&gt; &lt;i&gt;{ITEM.VALUE1}&lt;/i&gt;

Tempo do evento: {EVENT.AGE} 
&lt;a href=&quot;{HOST.IP}&quot;&gt;{HOST.IP}&lt;/a&gt;
&lt;i&gt;{EVENT.SEVERITY}&lt;/i&gt;</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4395" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>No item <strong>Operações de recuperação</strong> faremos praticamente o mesmo:</p>
<p><strong>Assunto</strong>:</p>
<pre class="remontti-code"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Resolvido: &lt;b&gt;{HOST.NAME}&lt;/b&gt;</pre>
<p><strong>Mensagem padrão</strong></p>
<pre class="remontti-code">&lt;code&gt;{EVENT.NAME}&lt;/code&gt;
&lt;b&gt;{ITEM.NAME1}&lt;/b&gt; &lt;i&gt;{ITEM.VALUE1}&lt;/i&gt;

Tempo do evento: {EVENT.AGE} 
&lt;a href=&quot;{HOST.IP}&quot;&gt;{HOST.IP}&lt;/a&gt;
&lt;i&gt;{EVENT.SEVERITY}&lt;/i&gt;
ID&#039;s: {ITEM.ID}/{EVENT.ID}</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4396" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>No item <strong>Operações de atualização</strong><br />
<strong>Assunto</strong>:</p>
<pre class="remontti-code">Problema atualizado: {EVENT.NAME}</pre>
<p><strong>Mensagem padrão</strong></p>
<pre class="remontti-code">{USER.FULLNAME} {EVENT.UPDATE.ACTION} problema em {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}
O status atual do problema é {EVENT.STATUS}, reconhecido: {EVENT.ACK.STATUS}.</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4397" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Operações configurada, clique em atualizar.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13.png" alt="" width="1680" height="544" class="aligncenter size-full wp-image-4398" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-300x97.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-1024x332.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-768x249.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-1536x497.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Pronto! Agora precisamos gerar um incidente para ver se nosso alerta será enviado para o Telegram.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-3080" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14-576x1024.png 576w, https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14-169x300.png 169w, https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14.png 720w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>O sistema de envio de mensagem está concluído! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h1>Grafana v7/v8</h1>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana.png" alt="" width="1680" height="1050" class="aligncenter size-full wp-image-4367" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-300x188.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1024x640.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-768x480.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1536x960.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a><br />
Pacotes necessários:</p>
<pre class="remontti-code"># apt install gnupg2 apt-transport-https software-properties-common wget</pre>
<p><strong>Para versão 7.5.x:</strong> (Não recomendado)</p>
<pre class="remontti-code"># cd /tmp/
# wget https://dl.grafana.com/oss/release/grafana_7.5.11_amd64.deb
# apt install ./grafana_7.5.11_amd64.deb
# grafana-cli plugins update-all
# systemctl restart grafana-server</pre>
<p><strong>Para versão 8.2.x:</strong> (Não recomendado)</p>
<pre class="remontti-code"># cd /tmp/
# wget https://dl.grafana.com/oss/release/grafana_8.2.7_amd64.deb
# apt install ./grafana_8.2.7_amd64.deb
# grafana-cli plugins update-all
# systemctl restart grafana-server</pre>
<p>Outras versões consulte <a href="https://grafana.com/grafana/download?edition=oss" rel="noopener" target="_blank">https://grafana.com/grafana/download?edition=oss</a></p>
<p><strong>Para Ultima versão v8.X:</strong> (Recomendado)<br />
Vamos baixar a key do repositório e adiciona-lo </p>
<pre class="remontti-code"># wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
# echo &quot;deb https://packages.grafana.com/oss/deb stable main&quot; | tee -a /etc/apt/sources.list.d/grafana.list</pre>
<p>Atualize o repositório e instale o grafana</p>
<pre class="remontti-code"># apt update
# apt install grafana</pre>
<p>Antes de iniciar o grafana, se deseja alterar a porta padrão <strong>3000</strong> (recomendo) edite:</p>
<pre class="remontti-code"># vim /etc/grafana/grafana.ini</pre>
<p>Localize <strong>http_port</strong> e defina a porta de sua escolha.</p>
<pre class="remontti-code"># The http port  to use
;http_port = 3000</pre>
<p>Exemplo:</p>
<pre class="remontti-code">http_port = 53000</pre>
<p>Instale o <strong>Plugin Zabbix</strong></p>
<pre class="remontti-code"># grafana-cli plugins install alexanderzobnin-zabbix-app</pre>
<p>É recomendado que mensalmente você faça atualizações dos plugins instalados, com o comando:</p>
<pre class="remontti-code"># grafana-cli plugins update-all</pre>
<p>Agora sim colocamos o Grafana para iniciar junto com a inicialização, ativamos e inicializamos o serviço:</p>
<pre class="remontti-code"># systemctl daemon-reload
# systemctl enable grafana-server
# systemctl start grafana-server</pre>
<p>Acesse em seu navegador <strong>http://IP_URL:3000</strong> ou pela porta que você alterou. O nome de usuário padrão é admin e a senha padrão é admin.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1.png" alt="" width="1370" height="781" class="aligncenter size-full wp-image-4368" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1-300x171.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1-1024x584.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1-768x438.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Ao fazer login pela primeira vez, você será solicitado a alterar sua senha.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2.png" alt="" width="1370" height="732" class="aligncenter size-full wp-image-4369" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2-300x160.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2-1024x547.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2-768x410.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Uhull <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3.png" alt="" width="1370" height="720" class="aligncenter size-full wp-image-4370" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3-1024x538.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3-768x404.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<h4>Integração do grafana com o Zabbix</h4>
<p>Acesse o Configuration &#8211;> Plugins:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7.png" alt="" width="1366" height="633" class="aligncenter size-full wp-image-4374" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7.png 1366w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7-300x139.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7-1024x475.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7-768x356.png 768w" sizes="auto, (max-width: 1366px) 100vw, 1366px" /></a></p>
<p>Localize o Zabbix e clique no mesmo<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5.png" alt="" width="1370" height="688" class="aligncenter size-full wp-image-4372" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5-300x151.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5-1024x514.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5-768x386.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Agora ative clicando em <strong>Enable</strong>.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6.png" alt="" width="1370" height="688" class="aligncenter size-full wp-image-4373" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6-300x151.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6-1024x514.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6-768x386.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Volte em Configuration &#8211;> Data Sources<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8.png" alt="" width="1366" height="633" class="aligncenter size-full wp-image-4375" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8.png 1366w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8-300x139.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8-1024x475.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8-768x356.png 768w" sizes="auto, (max-width: 1366px) 100vw, 1366px" /></a></p>
<p>Clique em <strong>Add data source</strong>.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9.png" alt="" width="1370" height="639" class="aligncenter size-full wp-image-4376" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9-300x140.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9-1024x478.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9-768x358.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Uma nova tela com varias fontes, localize Zabbix e clique em <strong>Select</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10.png" data-rel="lightbox-gallery-jBrNWFx4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10.png" alt="" width="1370" height="639" class="aligncenter size-full wp-image-4377" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10-300x140.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10-1024x478.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10-768x358.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Nas opções <strong>HTTP</strong> em <strong>URL</strong> informe o endereço do seu servidor Zabbix <strong>http://IP_URL/api_jsonrpc.php</strong>. Em <strong>Access</strong> selecione <strong>Browser</strong>. Em <strong>Zabbix API details</strong> informe seu usuário e senha do Zabbix e selecione a versão correspondente.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a.png" alt="" width="1043" height="1384" class="alignnone size-full wp-image-5524" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a.png 1043w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a-226x300.png 226w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a-772x1024.png 772w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a-768x1019.png 768w" sizes="auto, (max-width: 1043px) 100vw, 1043px" /></p>
<p>Role até o final e e clique em <strong>Save &#038; Test</strong> Se tudo ocorreu bem uma altera positivo com<strong>&#8220;Zabbix API version: 5.x.x&#8221;</strong> aparecerá.</p>
<p>Você pode também pode fazer uma conexão PostgreSQL com o banco de dados do zabbix, para tornar as coisas mais rápidas. Para isso basta &#8220;Add data source&#8221; pesquisar por PostgreSQL, então basta informa nome do banco, usuário e senha.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b.png" alt="" width="1043" height="1320" class="alignnone size-full wp-image-5525" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b.png 1043w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b-237x300.png 237w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b-809x1024.png 809w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b-768x972.png 768w" sizes="auto, (max-width: 1043px) 100vw, 1043px" /></p>
<p>Vá para as configurações do data source do zabbix, localize <strong>Direct DB Connection</strong>, ative-o e selecione <strong>PostgreSQL</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c.png" alt="" width="1040" height="501" class="alignnone size-full wp-image-5526" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c.png 1040w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c-300x145.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c-1024x493.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c-768x370.png 768w" sizes="auto, (max-width: 1040px) 100vw, 1040px" /></p>
<p>Agora vem a parte mais &#8220;chata/legal&#8221; que é você montar seus gráficos, como isso é algo bem peculiar de cada um, o intuito aqui era ensinar instalar. Recomendo a leitura de <a href="https://alexanderzobnin.github.io/grafana-zabbix/guides/gettingstarted/" rel="noopener noreferrer" target="_blank">Introdução ao Grafana-Zabbix</a> do autor do plugin.</p>
<h3>Bônus &#8211; Proxy Nginx grafana</h3>
<pre class="remontti-code"># vim /etc/nginx/sites-available/grafana.conf</pre>
<p>Adicione:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    server_name grafana.remontti.com.br;
  
    location / {
        proxy_pass http://localhost:53000;
        proxy_set_header   Host $host;
    }
}</pre>
<p>Cria o link para sites-enabled em seguida verifique as configurações e reinicie o serviço.</p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/grafana.conf /etc/nginx/sites-enabled/
# nginx -t
# systemctl restart nginx</pre>
<p>Simples né? Gostou e quer me ajudar? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p>Fontes:<br />
https://www.zabbix.com/download<br />
https://www.zabbix.com/documentation/<br />
https://grafana.com/docs/grafana/latest/installation/debian/<br />
https://grafana.com/grafana/plugins/alexanderzobnin-zabbix-app<br />
https://alexanderzobnin.github.io/grafana-zabbix/configuration/<br />
https://core.telegram.org/bots</p>
<p>O post <a href="https://blog.remontti.com.br/5517">Instalação do Zabbix 5 LTS + Grafana 7/8 + NGINX + PostgreSQL + Notificação Telegram com Debian 10/11</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5517/feed</wfw:commentRss>
			<slash:comments>28</slash:comments>
		
		
			</item>
		<item>
		<title>Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 10 Buster (LNPP)</title>
		<link>https://blog.remontti.com.br/5487</link>
					<comments>https://blog.remontti.com.br/5487#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 07 Apr 2021 20:56:22 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[buster]]></category>
		<category><![CDATA[certificado]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 10]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[letsencrypt]]></category>
		<category><![CDATA[LNMP]]></category>
		<category><![CDATA[lnpp]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[pgadmin]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[phppgadmin]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5487</guid>

					<description><![CDATA[<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5487">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 10 Buster (LNPP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP.png" alt="" width="720" height="340" class="alignnone size-full wp-image-5514" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP.png 720w, https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /><br />
Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor performance. O Apache, sem dúvidas, é o servidor web mais popular. No entanto, o NGINX a cada ano ganha mais popularidade e está sendo a preferência dos novos projetos. Também estarei instalando o banco de dados PostgreSQL e phpPgAdmin como gerenciador web. </p>
<p>Distribuição utilizada: <strong><a href="https://blog.remontti.com.br/2966" rel="noopener noreferrer" target="_blank">Debian 10 Stretch / Instalação Limpa</a></strong></p>
<h3>NGINX</h3>
<p><a href="https://www.nginx.com" rel="noopener" target="_blank">https://www.nginx.com</a></p>
<pre class="remontti-code"># apt install nginx</pre>
<p>Acesse agora em seu navegador http://IP-SERVIDOR/<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png" alt="" width="1100" height="310" class="alignnone size-full wp-image-5467" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png 1100w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-1024x289.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-768x216.png 768w" sizes="auto, (max-width: 1100px) 100vw, 1100px" /><br />
Se você acessar um diretório que não existe um erro dizendo que não existe, e junto informações que não é legal aparecer.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png" alt="" width="1036" height="296" class="alignnone size-full wp-image-5468" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png 1036w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-300x86.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-1024x293.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-768x219.png 768w" sizes="auto, (max-width: 1036px) 100vw, 1036px" /><br />
Vamos remover assinatura do nginx onde ele exibe a versão do mesmo. Ninguém precisa saber! Correto?</p>
<pre class="remontti-code"># sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png" alt="" width="712" height="157" class="alignnone size-full wp-image-5469" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png 712w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3-300x66.png 300w" sizes="auto, (max-width: 712px) 100vw, 712px" /></p>
<p>Pronto nosso NGINX está rodando! </p>
<h3>PostgreSQL</h3>
<pre class="remontti-code"># apt install postgresql postgresql-contrib</pre>
<p>Torne-se o usuário postgres, para poder criar o banco de dados.</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Execute para entrar no terminal de comandos do banco.</p>
<pre class="remontti-code">$ psql</pre>
<p>Para definir a senha do usuário postgres e instalar o adminpack.</p>
<pre class="remontti-code">postgres=# \password postgres
Digite nova senha para postgres: 
Digite-a novamente:
postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION
postgres=# \q 
$ exit</pre>
<p>Ajustes no pg_hba.conf, assim toda alteração será necessaria validação do postgres com a senha que acabou de definir.</p>
<pre class="remontti-code"># vim /etc/postgresql/11/main/pg_hba.conf</pre>
<p>Altere as seguintes linhas: </p>
<pre class="remontti-code">local   all             postgres                                peer
local   all             all                                     peer</pre>
<p>Para:</p>
<pre class="remontti-code">local   all             postgres                                md5
local   all             all                                     md5</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png" alt="" width="1010" height="268" class="alignnone size-full wp-image-5501" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png 1010w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-300x80.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-768x204.png 768w" sizes="auto, (max-width: 1010px) 100vw, 1010px" /><br />
Reinicie o postgres</p>
<pre class="remontti-code"># systemctl restart postgresql</pre>
<p>Volte para o postgres</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Agora para toda ação será necessário autenticar.</p>
<pre class="remontti-code">$ psql 
Senha para usuário postgres: !!SUA_SENHA!!
psql (11.11 (Debian 11.11-0+deb10u1))
Digite &quot;help&quot; para ajuda.
postgres-# \q</pre>
<p>Para demonstração irei criar um banco/usuário teste, não esqueça de alterar a senha.</p>
<pre class="remontti-code">$ createuser --pwprompt teste
Digite a senha para a nova role: &lt;&lt; NOVA SENHA PARA O USUÁRIO TESTE
Digite-a novamente: &lt;&lt; REPITA
Senha: &lt;&lt; SENHA DO QUE SETOU ANTES  NO COMANDO &quot;\password postgres&quot;</pre>
<p>Agora crie o  banco e vincule ao usuário.</p>
<pre class="remontti-code">$ createdb -O teste meubd
Senha: &lt;&lt;&lt; SENHA DO POSTGRES </pre>
<p>Verifique se o mesmo foi criado.</p>
<pre class="remontti-code">$ psql -l 
Senha para usuário postgres: 
                               Lista dos bancos de dados
   Nome    |   Dono   | Codificação |   Collate   |    Ctype    | Privilégios de acesso 
-----------+----------+-------------+-------------+-------------+-----------------------
 meubd     | teste    | UTF8        | pt_BR.UTF-8 | pt_BR.UTF-8 | 
....
....</pre>
<p>Acessamos agora o bd teste.</p>
<pre class="remontti-code">$ psql -U teste -d meubd
Senha para usuário postgres: 
psql (11.11 (Debian 11.11-0+deb10u1))
Digite &quot;help&quot; para ajuda.

meubd=&gt;</pre>
<p>Vamos fazer uma "brincadeira" só para testar, criaremos uma tabela e inseriremos dados nela.</p>
<pre class="remontti-code">meubd=&gt; CREATE TABLE doacao ( id int,nome text, valor text );
meubd=&gt; INSERT INTO doacao (id,nome,valor) values (1,&#039;Rudimar Remontti&#039;,&#039;R$ 5,00&#039;); 
meubd=&gt; SELECT * FROM doacao;

 id |       nome       |  valor  
----+------------------+---------
  1 | Rudimar Remontti | R$ 5,00

meubd=&gt; \q</pre>
<p>Se deseja remover o banco/usuário teste.</p>
<pre class="remontti-code">$ dropdb meubd
$ dropuser teste</pre>
<p>Volte para root</p>
<pre class="remontti-code">$ exit</pre>
<h3>PHP7</h3>
<p>Incluirei algumas extensões do PHP que são normalmente utilizada também na instalação.</p>
<pre class="remontti-code"># apt install php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}</pre>
<p>Agora vamos fazer a "integração" do PHP com o NGINX. Moveremos o arquivo defaul.</p>
<pre class="remontti-code"># mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original</pre>
<p>Crie um novo:</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Ajuste:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Teste a configuração se não tem nada errado e restart os serviços:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx php7.3-fpm</pre>
<p>Vamos criar um arquivo em PHP para testa se nosso NGINX está interpretando o PHP.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo();&#039; &gt;&gt; /var/www/html/teste.php</pre>
<p>Acesse em seu navegador http://IP-SERVIDOR/teste.php<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7.png" alt="" width="1173" height="899" class="alignnone size-full wp-image-5473" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7.png 1173w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-300x230.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-1024x785.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-768x589.png 768w" sizes="auto, (max-width: 1173px) 100vw, 1173px" /><br />
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Nosso servidor WEB com PHP está funcionando! </p>
<p>Exemplo para multiplos domínios/subdomínios </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub1.conf</pre>
<p>Neste ex: vou representar o <em>sub1.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub1;
    index index.php index.html index.htm;

    server_name sub1.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub2e3.conf</pre>
<p>Neste ex: vou representar o <em>sub2.remontti.com.br</em> e <em>sub3.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name sub2.remontti.com.br sub3.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Link os arquivos no diretório "/etc/nginx/sites-available"  que será carregado as novas configurações </p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/sub1.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/sub2e3.conf /etc/nginx/sites-enabled/</pre>
<p>Crie os diretórios referente a cada <strong>server_name</strong>.</p>
<pre class="remontti-code"># mkdir /var/www/sub1
# mkdir /var/www/sub2e3
# echo &#039;&lt;?php echo &quot;Olá mundo do sub1!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub1/index.php
# echo &#039;&lt;?php echo &quot;Olá mundo do sub2e3!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub2e3/index.php
</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h3>phpPgAdmin</h3>
<p>O phppgadmin até pode ser instalado via apt, porém seu empacotamento esta na versão 5, vou baixar a versão mais recente direta do <a href="https://github.com/phppgadmin/phppgadmin/releases" rel="noopener" target="_blank">https://github.com/phppgadmin/phppgadmin/releases</a> hoje (abril 2021) na versão 7.13.0</p>
<pre class="remontti-code"># apt install wget 
# cd /tmp/
# wget https://github.com/phppgadmin/phppgadmin/releases/download/REL_7-13-0/phpPgAdmin-7.13.0.tar.gz
# tar vxf phpPgAdmin-7.13.0.tar.gz
# mv /tmp/phpPgAdmin-7.13.0 /usr/share/phppgadmin</pre>
<p>Ajustes no config.inc.php</p>
<pre class="remontti-code"># vim /usr/share/phppgadmin/conf/config.inc.php</pre>
<p>Localize as linhas e ajuste:</p>
<pre class="remontti-code">$conf[&#039;servers&#039;][0][&#039;host&#039;] = &#039;localhost&#039;;
$conf[&#039;extra_login_security&#039;] = false;
$conf[&#039;owned_only&#039;] = true;</pre>
<p>Para torna-lo acessível altere o arquivo de configuração do seu NGINX, no exemplo vou colocar no arquivo default, mas você poderia estar configurando em seus domínios. </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Adicione as linhas destacadas:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }

    location ^~ /phppgadmin {
        root /usr/share;
        try_files $uri $uri/ =404;

        #allow  192.168.87.0/24;
        #allow  2001:0db8::/32;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;

        location ~ .php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        }

    }

}</pre>
<p>Se deseja tonar o phppgadmin acessível apenas de alguns endereços IPs (RECOMENDO) basta descomentar as linhas, e incluir seus prefixos. O error_page é para que quando a o acessante levar um proibido seja direcionado para um site.</p>
<pre class="remontti-code">allow  192.168.87.0/24;
allow  2001:0db8::/32;
deny   all;
error_page  403   http://www.remontti.com.br;</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<p>Basta acessar http://IP-SERVIDOR/phppgadmin<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7.png" alt="" width="1033" height="340" class="alignnone size-full wp-image-5495" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7.png 1033w, https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7-300x99.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7-1024x337.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7-768x253.png 768w" sizes="auto, (max-width: 1033px) 100vw, 1033px" /><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2.png" alt="" width="1401" height="576" class="alignnone size-full wp-image-5511" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2.png 1401w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2-300x123.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2-1024x421.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2-768x316.png 768w" sizes="auto, (max-width: 1401px) 100vw, 1401px" /></p>
<h3>LETSENCRYPT</h3>
<p>Criando certificado valido para nossos domínios.</p>
<pre class="remontti-code"># apt install letsencrypt python-certbot-nginx</pre>
<p>Tenha seu(s) domínio(s) configurado em /etc/nginx/sites-enabled/</p>
<pre class="remontti-code"># letsencrypt</pre>
<p>Retorno do questionário:</p>
<pre class="remontti-code">Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter &#039;c&#039; to
cancel): dev@null.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let&#039;s Encrypt project and the non-profit
organization that develops Certbot? We&#039;d like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: sub1.remontti.com.br
2: sub2.remontti.com.br   &lt;&lt; CASO VOCÊ TENHA MAIS DE UM SUB CONFIGURADO
3: sub3.remontti.com.br    &lt;&lt; IRÁ APARECER AQUI 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter &#039;c&#039; to cancel): 1 &lt;&lt; ESCOLHA QUAIS VC DESEJA
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for sub1.remontti.com.br
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/sub1.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you&#039;re confident your site works on HTTPS. You can undo this
change by editing your web server&#039;s configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press &#039;c&#039; to cancel): 2 &lt;&lt; SE QUISER FORCAR SEMPRE HTTPS
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/sub1.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled
https://sub1.remontti.com.br

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=sub1.remontti.com.br
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/sub1.remontti.com.br/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/sub1.remontti.com.br/privkey.pem
   Your cert will expire on 2021-07-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the &quot;certonly&quot; option. To non-interactively renew *all* of
   your certificates, run &quot;certbot renew&quot;
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let&#039;s Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le
</pre>
<p>Você pode também criar o certificado diretamente para um domínio. </p>
<pre class="remontti-code"># letsencrypt --authenticator standalone --installer nginx -d sub1.remontti.com.br</pre>
<p>Dica, se desejar desativar o TLS1.0 e TLS1.1 após criar um certificado um arquivo é criado /etc/letsencrypt/options-ssl-apache.conf, então edite e inclua no SSLProtocol TLSv1 -TLSv1.1</p>
<pre class="remontti-code"># vim /etc/letsencrypt/options-ssl-apache.conf</pre>
<p>Ficando</p>
<pre class="remontti-code">#SSLProtocol            all -SSLv2 -SSLv3
SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1</pre>
<p>Reinicie o Apache:</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Para testar acesse: <a href="https://www.cdn77.com/tls-test/" rel="noopener" target="_blank">https://www.cdn77.com/tls-test/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png" data-rel="lightbox-gallery-lTrWt8bB" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png" alt="" width="300" height="182" class="alignnone size-medium wp-image-6158" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-1024x620.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-768x465.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png 1099w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Não esqueça de colocar no seu cron para ele renovar o certificado, pois a cada 90 ele expira. Neste exemplo todo dia primeiro tento renovar.</p>
<pre class="remontti-code"># echo &#039;00 00   1 * *   root    /usr/bin/certbot -q renew&#039; &gt;&gt; /etc/crontab
# systemctl restart cron</pre>
<p>Caso não renovar apenas rode o comando letsencrypt novamente. </p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fontes:</strong> <a href="https://docs.nginx.com/" rel="noopener" target="_blank">https://docs.nginx.com/</a><br />
<a href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/" rel="noopener" target="_blank">https://docs.nginx.com/nginx/admin-guide/web-server/web-server/</a></p>
<p>O post <a href="https://blog.remontti.com.br/5487">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 10 Buster (LNPP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5487/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Servidor WEB NGINX + PHP + MariaDB + phpMyAdmin + Letsencrypt no Debian 10 Buster (LNMP)</title>
		<link>https://blog.remontti.com.br/5465</link>
					<comments>https://blog.remontti.com.br/5465#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 07 Apr 2021 00:44:49 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[LNMP]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[webserver]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5465</guid>

					<description><![CDATA[<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5465">Servidor WEB NGINX + PHP + MariaDB + phpMyAdmin + Letsencrypt no Debian 10 Buster (LNMP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX.png" alt="" width="720" height="340" class="alignnone size-full wp-image-5485" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX.png 720w, https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /><br />
Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor performance. O Apache, sem dúvidas, é o servidor web mais popular. No entanto, o NGINX a cada ano ganha mais popularidade e está sendo a preferência dos novos projetos.</p>
<p>Distribuição utilizada: <strong><a href="https://blog.remontti.com.br/2966" rel="noopener noreferrer" target="_blank">Debian 10 Stretch / Instalação Limpa</a></strong></p>
<h3>NGINX</h3>
<p><a href="https://www.nginx.com" rel="noopener" target="_blank">https://www.nginx.com</a></p>
<pre class="remontti-code"># apt install nginx</pre>
<p>Acesse agora em seu navegador http://IP-SERVIDOR/<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png" alt="" width="1100" height="310" class="alignnone size-full wp-image-5467" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png 1100w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-1024x289.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-768x216.png 768w" sizes="auto, (max-width: 1100px) 100vw, 1100px" /><br />
Se você acessar um diretório que não existe um erro dizendo que não existe, e junto informações que não é legal aparecer.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png" alt="" width="1036" height="296" class="alignnone size-full wp-image-5468" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png 1036w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-300x86.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-1024x293.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-768x219.png 768w" sizes="auto, (max-width: 1036px) 100vw, 1036px" /><br />
Vamos remover assinatura do nginx onde ele exibe a versão do mesmo. Ninguém precisa saber! Correto?</p>
<pre class="remontti-code"># sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png" alt="" width="712" height="157" class="alignnone size-full wp-image-5469" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png 712w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3-300x66.png 300w" sizes="auto, (max-width: 712px) 100vw, 712px" /></p>
<p>Pronto nosso NGINX está rodando! </p>
<h3>MARIADB</h3>
<p>MariaDB para quem ainda não sabe é um fork do MySQL, criado pelo próprio fundador do projeto MySQL após sua aquisição pela Oracle.</p>
<pre class="remontti-code"># apt install mariadb-server mariadb-client</pre>
<p>Por segurança vamos setar uma senha do </p>
<pre class="remontti-code"># mariadb -u root</pre>
<p>Não use a mesma senha do seu servidor, crie uma nova totalmente diferente! Dica acesse<a href="https://senhasegura.remontti.com.br/" rel="noopener" target="_blank"> https://senhasegura.remontti.com.br/</a> e gere uma!</p>
<pre class="remontti-code">USE mysql;
UPDATE user SET password=PASSWORD(&#039;SENHA&#039;) WHERE User=&#039;root&#039;;
UPDATE user SET plugin=&quot;mysql_native_password&quot;;
FLUSH PRIVILEGES;
quit;</pre>
<p>Agora quando for acessar o mariadb será necessário informar a senha.</p>
<pre class="remontti-code"># mariadb -u root -p</pre>
<h3>PHP7</h3>
<p>Incluirei algumas extensões do PHP que são normalmente utilizada também na instalação.</p>
<pre class="remontti-code"># apt install php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json}</pre>
<p>Agora vamos fazer a &#8220;integração&#8221; do PHP com o NGINX. Moveremos o arquivo defaul.</p>
<pre class="remontti-code"># mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original</pre>
<p>Crie um novo:</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Ajuste:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Teste a configuração se não tem nada errado e restart os serviços:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx php7.3-fpm</pre>
<p>Vamos criar um arquivo em PHP para testa se nosso NGINX está interpretando o PHP.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo();&#039; &gt;&gt; /var/www/html/teste.php</pre>
<p>Acesse em seu navegador http://IP-SERVIDOR/teste.php<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7.png" alt="" width="1173" height="899" class="alignnone size-full wp-image-5473" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7.png 1173w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-300x230.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-1024x785.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-768x589.png 768w" sizes="auto, (max-width: 1173px) 100vw, 1173px" /><br />
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Nosso servidor WEB com PHP está funcionando! </p>
<p>Exemplo para multiplos domínios/subdomínios </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub1.conf</pre>
<p>Neste ex: vou representar o <em>sub1.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub1;
    index index.php index.html index.htm;

    server_name sub1.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub2e3.conf</pre>
<p>Neste ex: vou representar o <em>sub2.remontti.com.br</em> e <em>sub3.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name sub2.remontti.com.br sub3.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Link os arquivos no diretório &#8220;/etc/nginx/sites-available&#8221;  que será carregado as novas configurações </p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/sub1.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/sub2e3.conf /etc/nginx/sites-enabled/</pre>
<p>Crie os diretórios referente a cada <strong>server_name</strong>.</p>
<pre class="remontti-code"># mkdir /var/www/sub1
# mkdir /var/www/sub2e3
# echo &#039;&lt;?php echo &quot;Olá mundo do sub1!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub1/index.php
# echo &#039;&lt;?php echo &quot;Olá mundo do sub2e3!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub2e3/index.php
</pre>
<p>Verifique se não tem nenhum erro e restart:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h3>phpMyAdmin</h3>
<p>Cade ele do repositório? O PHPMyAdmin não está mais disponível como pacote .deb no Debian 10. Fazendo um pesquisa o motivo é que o &#8220;pessoal&#8221; que faz empacotamento não tem uma versão estável. <a href="https://security-tracker.debian.org/tracker/CVE-2018-19968" rel="noopener noreferrer" target="_blank">https://security-tracker.debian.org/tracker/CVE-2018-19968</a><br />
Desta forma debian &#8220;obriga&#8221; com que o usuário instale-o a partir da fonte. <a href="https://www.phpmyadmin.net/downloads/" rel="noopener noreferrer" target="_blank">https://www.phpmyadmin.net/downloads/</a></p>
<pre class="remontti-code"># apt install wget
# cd /tmp/
# wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-all-languages.tar.gz
# tar -vxzf phpMyAdmin-5.1.0-all-languages.tar.gz -C /usr/share/
# mv /usr/share/phpMyAdmin-5.1.0-all-languages /usr/share/phpmyadmin
# mkdir /etc/phpmyadmin
# touch /etc/phpmyadmin/htpasswd.setup
# mkdir -p /var/lib/phpmyadmin/tmp
# chown www-data. /var/lib/phpmyadmin/ -R</pre>
<p>Para nosso phpmyadmin funcionar corretamente precisamos criar um banco de dados para ele, e por segurança vamos tb criar um usuário só para ele.</p>
<pre class="remontti-code"># mariadb -p</pre>
<p>Não esqueça de alterar &#8220;SUA_SENHA&#8221;.</p>
<pre class="remontti-code">CREATE DATABASE phpmyadmin;
CREATE USER &#039;pma&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUA_SENHA&#039;;
GRANT ALL PRIVILEGES ON phpmyadmin.* TO &#039;pma&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUA_SENHA&#039; WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;</pre>
<p>Agora vamos importar as tabelas e configura-lo.</p>
<pre class="remontti-code"># mariadb -u root -p phpmyadmin &lt; /usr/share/phpmyadmin/sql/create_tables.sql
# cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
# vim /usr/share/phpmyadmin/config.inc.php</pre>
<p>Descomente/Adicone/Altere:</p>
<pre class="remontti-code">/* INFORME O BLOWFISH SECRET USE O GERADOR DE SENHA. DEVE TER 32 CARACTERES */
$cfg[&#039;blowfish_secret&#039;] = &#039;dkJhGx83XR3JjuFrDn8kPp9NtXnkLptl&#039;;

/* ADICIONE  */
$cfg[&#039;TempDir&#039;] = &#039;/var/lib/phpmyadmin/tmp&#039;;

/* DESCOMENTE */ 
/* User used to manipulate with storage */
$cfg[&#039;Servers&#039;][$i][&#039;controlhost&#039;] = &#039;localhost&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;controlport&#039;] = &#039;&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;controluser&#039;] = &#039;pma&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;controlpass&#039;] = &#039;SUA_SENHA&#039;;
 
/* DESCOMENTE */
/* Storage database and tables */
$cfg[&#039;Servers&#039;][$i][&#039;pmadb&#039;] = &#039;phpmyadmin&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;bookmarktable&#039;] = &#039;pma__bookmark&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;relation&#039;] = &#039;pma__relation&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;table_info&#039;] = &#039;pma__table_info&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;table_coords&#039;] = &#039;pma__table_coords&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;pdf_pages&#039;] = &#039;pma__pdf_pages&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;column_info&#039;] = &#039;pma__column_info&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;history&#039;] = &#039;pma__history&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;table_uiprefs&#039;] = &#039;pma__table_uiprefs&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;tracking&#039;] = &#039;pma__tracking&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;userconfig&#039;] = &#039;pma__userconfig&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;recent&#039;] = &#039;pma__recent&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;favorite&#039;] = &#039;pma__favorite&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;users&#039;] = &#039;pma__users&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;usergroups&#039;] = &#039;pma__usergroups&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;navigationhiding&#039;] = &#039;pma__navigationhiding&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;savedsearches&#039;] = &#039;pma__savedsearches&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;central_columns&#039;] = &#039;pma__central_columns&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;designer_settings&#039;] = &#039;pma__designer_settings&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;export_templates&#039;] = &#039;pma__export_templates&#039;;</pre>
<p>Para torna-lo acessível altere o arquivo de configuração do seu NGINX, no exemplo vou colocar no arquivo default, mas você poderia estar configurando em seus domínios. </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Adicione as linhas destacadas:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }

    location ^~ /phpmyadmin {
        root /usr/share;
        try_files $uri $uri/ =404;

        #allow  192.168.87.0/24;
        #allow  2001:0db8::/32;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;

        location ~ .php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        }

    }

}</pre>
<p>Se deseja tonar o phpmyadmin acessivel apenas de alguns endereços IPs basta descomentar as linhas, e incluir seus prefixos. O error_page é para que quando a o acessante levar um proibido seja direcionado para um site.</p>
<pre class="remontti-code">allow  192.168.87.0/24;
allow  2001:0db8::/32;
deny   all;
error_page  403   http://www.remontti.com.br;</pre>
<p>Basta acessar http://IP-SERVIDOR/phpmyadmin</p>
<h3>LETSENCRYPT</h3>
<p>Criando certificado valido para nossos domínios.</p>
<pre class="remontti-code"># apt install letsencrypt python-certbot-nginx</pre>
<p>Tenha seu(s) domínio(s) configurado em /etc/nginx/sites-enabled/</p>
<pre class="remontti-code"># letsencrypt</pre>
<p>Retorno do questionário:</p>
<pre class="remontti-code">Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter &#039;c&#039; to
cancel): dev@null.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let&#039;s Encrypt project and the non-profit
organization that develops Certbot? We&#039;d like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: sub1.remontti.com.br
2: sub2.remontti.com.br   &lt;&lt; CASO VOCÊ TENHA MAIS DE UM SUB CONFIGURADO
3: sub3.remontti.com.br    &lt;&lt; IRÁ APARECER AQUI 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter &#039;c&#039; to cancel): 1 &lt;&lt; ESCOLHA QUAIS VC DESEJA
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for sub1.remontti.com.br
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/sub1.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you&#039;re confident your site works on HTTPS. You can undo this
change by editing your web server&#039;s configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press &#039;c&#039; to cancel): 2 &lt;&lt; SE QUISER FORCAR SEMPRE HTTPS
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/sub1.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled
https://sub1.remontti.com.br

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=sub1.remontti.com.br
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/sub1.remontti.com.br/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/sub1.remontti.com.br/privkey.pem
   Your cert will expire on 2021-07-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the &quot;certonly&quot; option. To non-interactively renew *all* of
   your certificates, run &quot;certbot renew&quot;
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let&#039;s Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le
</pre>
<p>Você pode também criar o certificado diretamente para um domínio. </p>
<pre class="remontti-code"># letsencrypt --authenticator standalone --installer nginx -d sub1.remontti.com.br</pre>
<p>Não esqueça de colocar no seu cron para ele renovar o certificado, pois a cada 90 ele expira. Neste exemplo todo dia primeiro tento renovar.</p>
<pre class="remontti-code"># echo &#039;00 00   1 * *   root    /usr/bin/certbot -q renew&#039; &gt;&gt; /etc/crontab
# systemctl restart cron</pre>
<p>Caso não renovar apenas rode o comando letsencrypt novamente. </p>
<h3>Bônus: Modelo para WordPress</h3>
<p>Como rewrite no NGINX é um pouco diferente vou deixar um ex.:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name remontti.com.br www.remontti.com.br;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Dica, se desejar desativar o TLS1.0 e TLS1.1 após criar um certificado um arquivo é criado /etc/letsencrypt/options-ssl-apache.conf, então edite e inclua no SSLProtocol TLSv1 -TLSv1.1</p>
<pre class="remontti-code"># vim /etc/letsencrypt/options-ssl-apache.conf</pre>
<p>Ficando</p>
<pre class="remontti-code">#SSLProtocol            all -SSLv2 -SSLv3
SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1</pre>
<p>Reinicie o Apache:</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Para testar acesse: <a href="https://www.cdn77.com/tls-test/" rel="noopener" target="_blank">https://www.cdn77.com/tls-test/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png" data-rel="lightbox-gallery-qYGERh6e" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png" alt="" width="300" height="182" class="alignnone size-medium wp-image-6158" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-1024x620.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-768x465.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png 1099w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fontes:</strong> <a href="https://docs.nginx.com/" rel="noopener" target="_blank">https://docs.nginx.com/</a><br />
<a href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/" rel="noopener" target="_blank">https://docs.nginx.com/nginx/admin-guide/web-server/web-server/</a></p>
<p>O post <a href="https://blog.remontti.com.br/5465">Servidor WEB NGINX + PHP + MariaDB + phpMyAdmin + Letsencrypt no Debian 10 Buster (LNMP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5465/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Como instalar Netbox, ferramenta grátis para documentar sua rede</title>
		<link>https://blog.remontti.com.br/5412</link>
					<comments>https://blog.remontti.com.br/5412#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Fri, 19 Mar 2021 20:06:22 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[buster]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[documentação]]></category>
		<category><![CDATA[netbox]]></category>
		<category><![CDATA[nginx]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5412</guid>

					<description><![CDATA[<p>Netbox é um aplicativo web de código aberto projetado para ajudar a gerenciar e documentar redes de computadores. Concebido inicialmente pela equipe de engenharia de rede da DigitalOcean , o NetBox foi desenvolvido especificamente&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5412">Como instalar Netbox, ferramenta grátis para documentar sua rede</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox.png" alt="" width="416" height="121" class="alignnone size-full wp-image-5421" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox.png 416w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-300x87.png 300w" sizes="auto, (max-width: 416px) 100vw, 416px" /><br />
<a href="https://netbox.readthedocs.io/en/stable/" rel="noopener" target="_blank">Netbox</a> é um aplicativo web de código aberto projetado para ajudar a gerenciar e documentar redes de computadores. Concebido inicialmente pela equipe de engenharia de rede da DigitalOcean , o NetBox foi desenvolvido especificamente para atender às necessidades dos engenheiros de rede e infraestrutura. Abrange os seguintes aspectos de gerenciamento de rede:</p>
<p>Gerenciamento de endereço IP (IPAM) &#8211; redes e endereços IP, VRFs e VLANs</p>
<ul>
<li><strong>Racks de equipamentos</strong> &#8211; organizados por grupo e local</li>
<li><strong>Dispositivos</strong> &#8211; Tipos de dispositivos e onde estão instalados</li>
<li><strong>Conexões</strong> &#8211; Rede, console e conexões de energia entre dispositivos</li>
<li><strong>Virtualização</strong> &#8211; máquinas virtuais e clusters</li>
<li><strong>Circuitos de dados</strong> &#8211; circuitos e provedores de comunicações de longa distância</li>
<li><strong>Segredos</strong> &#8211; armazenamento criptografado de credenciais confidenciais</li>
</ul>
<p><strong>Requisitos:</strong><br />
Como de costume vou realizar a <a href="https://blog.remontti.com.br/2966" rel="noopener" target="_blank">instalação no<strong> Debian 10</strong> limpo </a>(sem pacotes extras)<br />
Vire root da forma correta, colocando após os su o &#8220;-&#8220;. </p>
<pre class="remontti-code">su -</pre>
<p>Instale os pacotes que serão requisitos.</p>
<pre class="remontti-code"># apt install vim net-tools wget redis-server supervisor\
  postgresql-contrib postgresql libpq-dev gcc\
  python-minimal python3 python3-pip python3-venv\
  python3-dev build-essential libxml2-dev libxslt1-dev\
  libffi-dev libssl-dev zlib1g-dev graphviz\
  nginx redis python3-setuptools</pre>
<p>Vire o usuário postgres, para poder criar nosso banco de dados.</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Entre no terminal de comandos do postgres</p>
<pre class="remontti-code">$ psql</pre>
<p>Não esqueça de alterar a <strong>senha</strong>.</p>
<pre class="remontti-code">postgres=# CREATE DATABASE netboxdb;
postgres=# CREATE USER netboxuser WITH PASSWORD &#039;senha&#039;;
postgres=# GRANT ALL PRIVILEGES ON DATABASE netboxdb TO netboxuser;
postgres=# exit</pre>
<p> Verifique ser o serviço redis esta respondendo.</p>
<pre class="remontti-code">$ redis-cli ping</pre>
<p>Deve retornar : <strong>PONG</strong><br />
Retorne ao usuario root</p>
<pre class="remontti-code">exit</pre>
<p>Atualize o pip</p>
<pre class="remontti-code"># pip3 install --upgrade pip</pre>
<p>Agora vamos baixar o projeto NetBox. Verifique em <a href="https://github.com/netbox-community/netbox/releases" rel="noopener" target="_blank">https://github.com/netbox-community/netbox/releases</a> não existe uma nova versão.<br />
Entre em tmp (diretório temporário do linux que após um reboot é apagado) em seguida fizemos o download, extraímos, movemos para o diretório correto bem como ajustamos permissões do diretório que faremos upload de arquivos.</p>
<pre class="remontti-code"># cd /tmp
# wget https://github.com/netbox-community/netbox/archive/refs/tags/v2.10.8.tar.gz
# tar vxf v2.10.8.tar.gz
# mv netbox*/ /opt/netbox
# cd /opt/netbox/
# chown www-data. /opt/netbox/netbox/media/ -R</pre>
<p>Execute o comando abaixo para gerar nossa SECRET KEY que iremos usar em seguida.</p>
<pre class="remontti-code"># /opt/netbox/netbox/generate_secret_key.py </pre>
<p>Ex.:</p>
<pre class="remontti-code-plain">T7TE07O$j^Jqf9(*20q8M5kG4%NBIci#gEEn0$wuw*qodT7Lfo</pre>
<p>Copie o arquivo de configuração exemplo para ajustar com suas infomações</p>
<pre class="remontti-code"># cp /opt/netbox/netbox/netbox/configuration.example.py /opt/netbox/netbox/netbox/configuration.py
# vim /opt/netbox/netbox/netbox/configuration.py</pre>
<p>Localize as linhas como exemplo abaixo e altere os valores.</p>
<pre class="remontti-code">ALLOWED_HOSTS = [&#039;localhost&#039;,&#039;netbox.remontti.com.br&#039;]

DATABASE = {
    &#039;NAME&#039;: &#039;netboxdb&#039;,       # Database name
    &#039;USER&#039;: &#039;netboxuser&#039;,     # PostgreSQL username
    &#039;PASSWORD&#039;: &#039;senha&#039;,      # PostgreSQL password
    &#039;HOST&#039;: &#039;localhost&#039;,      # Database server
    &#039;PORT&#039;: &#039;&#039;,               # Database port (leave blank for default)
    &#039;CONN_MAX_AGE&#039;: 300,      # Max database connection age
}
# Gerado com o comando /opt/netbox/netbox/generate_secret_key.py
SECRET_KEY = &#039;T7TE07O$j^Jqf9(*20q8M5kG4%NBIci#gEEn0$wuw*qodT7Lfo&#039;

LOGIN_REQUIRED = True</pre>
<p>Instalaremos os pacotes do py requeiridos.</p>
<pre class="remontti-code"># pip3 install -r /opt/netbox/requirements.txt</pre>
<p>Vamos a instalção do bichão!</p>
<pre class="remontti-code"># cd /opt/netbox/netbox/
# python3 manage.py migrate</pre>
<pre class="remontti-code-plain">Operations to perform:
  Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying tenancy.0001_initial... OK
  Applying tenancy.0002_tenant_group_optional... OK
  Applying tenancy.0003_unicode_literals... OK
  Applying taggit.0001_initial... OK
  Applying taggit.0002_auto_20150616_2121... OK
  Applying tenancy.0004_tags... OK
  Applying tenancy.0005_change_logging... OK
  Applying dcim.0001_initial... OK
  Applying ipam.0001_initial... OK
  Applying dcim.0002_auto_20160622_1821... OK
  Applying extras.0001_initial... OK
  Applying extras.0002_custom_fields... OK
  Applying extras.0003_exporttemplate_add_description... OK
  Applying extras.0004_topologymap_change_comma_to_semicolon... OK
  Applying extras.0005_useraction_add_bulk_create... OK
  Applying extras.0006_add_imageattachments... OK
  Applying extras.0007_unicode_literals... OK
  Applying extras.0008_reports... OK
  Applying extras.0009_topologymap_type... OK
  Applying extras.0010_customfield_filter_logic... OK
  Applying extras.0011_django2... OK
  Applying extras.0012_webhooks... OK
  Applying extras.0013_objectchange... OK
  Applying ipam.0002_vrf_add_enforce_unique... OK
  Applying dcim.0003_auto_20160628_1721... OK
  Applying dcim.0004_auto_20160701_2049... OK
  Applying dcim.0005_auto_20160706_1722... OK
  Applying dcim.0006_add_device_primary_ip4_ip6... OK
  Applying dcim.0007_device_copy_primary_ip... OK
  Applying dcim.0008_device_remove_primary_ip... OK
  Applying dcim.0009_site_32bit_asn_support... OK
  Applying dcim.0010_devicebay_installed_device_set_null... OK
  Applying ipam.0003_ipam_add_vlangroups... OK
  Applying ipam.0004_ipam_vlangroup_uniqueness... OK
  Applying ipam.0005_auto_20160725_1842... OK
  Applying ipam.0006_vrf_vlan_add_tenant... OK
  Applying ipam.0007_prefix_ipaddress_add_tenant... OK
  Applying ipam.0008_prefix_change_order... OK
  Applying ipam.0009_ipaddress_add_status... OK
  Applying ipam.0010_ipaddress_help_texts... OK
  Applying ipam.0011_rir_add_is_private... OK
  Applying dcim.0011_devicetype_part_number... OK
  Applying dcim.0012_site_rack_device_add_tenant... OK
  Applying dcim.0013_add_interface_form_factors... OK
  Applying dcim.0014_rack_add_type_width... OK
  Applying dcim.0015_rack_add_u_height_validator... OK
  Applying dcim.0016_module_add_manufacturer... OK
  Applying dcim.0017_rack_add_role... OK
  Applying dcim.0018_device_add_asset_tag... OK
  Applying dcim.0019_new_iface_form_factors... OK
  Applying dcim.0020_rack_desc_units... OK
  Applying dcim.0021_add_ff_flexstack... OK
  Applying dcim.0022_color_names_to_rgb... OK
  Applying ipam.0012_services... OK
  Applying ipam.0013_prefix_add_is_pool... OK
  Applying ipam.0014_ipaddress_status_add_deprecated... OK
  Applying ipam.0015_global_vlans... OK
  Applying ipam.0016_unicode_literals... OK
  Applying ipam.0017_ipaddress_roles... OK
  Applying ipam.0018_remove_service_uniqueness_constraint... OK
  Applying dcim.0023_devicetype_comments... OK
  Applying dcim.0024_site_add_contact_fields... OK
  Applying dcim.0025_devicetype_add_interface_ordering... OK
  Applying dcim.0026_add_rack_reservations... OK
  Applying dcim.0027_device_add_site... OK
  Applying dcim.0028_device_copy_rack_to_site... OK
  Applying dcim.0029_allow_rackless_devices... OK
  Applying dcim.0030_interface_add_lag... OK
  Applying dcim.0031_regions... OK
  Applying dcim.0032_device_increase_name_length... OK
  Applying dcim.0033_rackreservation_rack_editable... OK
  Applying dcim.0034_rename_module_to_inventoryitem... OK
  Applying dcim.0035_device_expand_status_choices... OK
  Applying dcim.0036_add_ff_juniper_vcp... OK
  Applying dcim.0037_unicode_literals... OK
  Applying dcim.0038_wireless_interfaces... OK
  Applying dcim.0039_interface_add_enabled_mtu... OK
  Applying dcim.0040_inventoryitem_add_asset_tag_description... OK
  Applying dcim.0041_napalm_integration... OK
  Applying dcim.0042_interface_ff_10ge_cx4... OK
  Applying dcim.0043_device_component_name_lengths... OK
  Applying virtualization.0001_virtualization... OK
  Applying ipam.0019_virtualization... OK
  Applying ipam.0020_ipaddress_add_role_carp... OK
  Applying dcim.0044_virtualization... OK
  Applying dcim.0045_devicerole_vm_role... OK
  Applying dcim.0046_rack_lengthen_facility_id... OK
  Applying dcim.0047_more_100ge_form_factors... OK
  Applying dcim.0048_rack_serial... OK
  Applying dcim.0049_rackreservation_change_user... OK
  Applying dcim.0050_interface_vlan_tagging... OK
  Applying dcim.0051_rackreservation_tenant... OK
  Applying dcim.0052_virtual_chassis... OK
  Applying dcim.0053_platform_manufacturer... OK
  Applying dcim.0054_site_status_timezone_description... OK
  Applying dcim.0055_virtualchassis_ordering... OK
  Applying dcim.0056_django2... OK
  Applying dcim.0057_tags... OK
  Applying dcim.0058_relax_rack_naming_constraints... OK
  Applying dcim.0059_site_latitude_longitude... OK
  Applying dcim.0060_change_logging... OK
  Applying dcim.0061_platform_napalm_args... OK
  Applying extras.0014_configcontexts... OK
  Applying extras.0015_remove_useraction... OK
  Applying extras.0016_exporttemplate_add_cable... OK
  Applying extras.0017_exporttemplate_mime_type_length... OK
  Applying extras.0018_exporttemplate_add_jinja2... OK
  Applying extras.0019_tag_taggeditem... OK
  Applying dcim.0062_interface_mtu... OK
  Applying dcim.0063_device_local_context_data... OK
  Applying dcim.0064_remove_platform_rpc_client... OK
  Applying dcim.0065_front_rear_ports... OK
  Applying circuits.0001_initial... OK
  Applying circuits.0002_auto_20160622_1821... OK
  Applying circuits.0003_provider_32bit_asn_support... OK
  Applying circuits.0004_circuit_add_tenant... OK
  Applying circuits.0005_circuit_add_upstream_speed... OK
  Applying circuits.0006_terminations... OK
  Applying dcim.0066_cables...
    Adding console connections... 0 cables created
    Adding power connections... 0 cables created
    Adding interface connections... 0 cables created
 OK
  Applying circuits.0007_circuit_add_description... OK
  Applying circuits.0008_circuittermination_interface_protect_on_delete... OK
  Applying circuits.0009_unicode_literals... OK
  Applying circuits.0010_circuit_status... OK
  Applying circuits.0011_tags... OK
  Applying circuits.0012_change_logging... OK
  Applying circuits.0013_cables...
    Adding circuit terminations... 0 cables created
 OK
  Applying circuits.0014_circuittermination_description... OK
  Applying circuits.0015_custom_tag_models... OK
  Applying circuits.0016_3569_circuit_fields... OK
  Applying circuits.0017_circuittype_description... OK
  Applying circuits.0018_standardize_description... OK
  Applying circuits.0019_nullbooleanfield_to_booleanfield... OK
  Applying virtualization.0002_virtualmachine_add_status... OK
  Applying virtualization.0003_cluster_add_site... OK
  Applying virtualization.0004_virtualmachine_add_role... OK
  Applying virtualization.0005_django2... OK
  Applying virtualization.0006_tags... OK
  Applying virtualization.0007_change_logging... OK
  Applying virtualization.0008_virtualmachine_local_context_data... OK
  Applying virtualization.0009_custom_tag_models... OK
  Applying virtualization.0010_cluster_add_tenant... OK
  Applying virtualization.0011_3569_virtualmachine_fields... OK
  Applying tenancy.0006_custom_tag_models... OK
  Applying virtualization.0012_vm_name_nonunique... OK
  Applying virtualization.0013_deterministic_ordering... OK
  Applying virtualization.0014_standardize_description... OK
  Applying ipam.0021_vrf_ordering... OK
  Applying ipam.0022_tags... OK
  Applying ipam.0023_change_logging... OK
  Applying ipam.0024_vrf_allow_null_rd... OK
  Applying ipam.0025_custom_tag_models... OK
  Applying ipam.0026_prefix_ordering_vrf_nulls_first... OK
  Applying ipam.0027_ipaddress_add_dns_name... OK
  Applying ipam.0028_3569_prefix_fields... OK
  Applying ipam.0029_3569_ipaddress_fields... OK
  Applying ipam.0030_3569_vlan_fields... OK
  Applying ipam.0031_3569_service_fields... OK
  Applying ipam.0032_role_description... OK
  Applying ipam.0033_deterministic_ordering... OK
  Applying ipam.0034_fix_ipaddress_status_dhcp... OK
  Applying ipam.0035_drop_ip_family... OK
  Applying ipam.0036_standardize_description... OK
  Applying secrets.0001_initial... OK
  Applying secrets.0002_userkey_add_session_key... OK
  Applying secrets.0003_unicode_literals... OK
  Applying secrets.0004_tags... OK
  Applying secrets.0005_change_logging... OK
  Applying secrets.0006_custom_tag_models... OK
  Applying dcim.0067_device_type_remove_qualifiers... OK
  Applying dcim.0068_rack_new_fields... OK
  Applying dcim.0069_deprecate_nullablecharfield... OK
  Applying dcim.0070_custom_tag_models... OK
  Applying extras.0020_tag_data... OK
  Applying extras.0021_add_color_comments_changelog_to_tag... OK
  Applying extras.0022_custom_links... OK
  Applying extras.0023_fix_tag_sequences... OK
  Applying extras.0024_scripts... OK
  Applying extras.0025_objectchange_time_index... OK
  Applying extras.0026_webhook_ca_file_path... OK
  Applying extras.0027_webhook_additional_headers... OK
  Applying extras.0028_remove_topology_maps... OK
  Applying extras.0029_3569_customfield_fields... OK
  Applying extras.0030_3569_objectchange_fields... OK
  Applying extras.0031_3569_exporttemplate_fields... OK
  Applying extras.0032_3569_webhook_fields... OK
  Applying extras.0033_graph_type_template_language... OK
  Applying extras.0034_configcontext_tags... OK
  Applying extras.0035_deterministic_ordering... OK
  Applying extras.0036_contenttype_filters_to_q_objects... OK
  Applying extras.0037_configcontexts_clusters... OK
  Applying extras.0038_webhook_template_support... OK
  Applying extras.0039_update_features_content_types... OK
  Applying extras.0040_standardize_description... OK
  Applying extras.0041_tag_description... OK
  Applying extras.0042_customfield_manager... OK
  Applying virtualization.0015_vminterface... OK
  Applying ipam.0037_ipaddress_assignment... OK
  Applying dcim.0071_device_components_add_description... OK
  Applying dcim.0072_powerfeeds... OK
  Applying dcim.0073_interface_form_factor_to_type... OK
  Applying dcim.0074_increase_field_length_platform_name_slug... OK
  Applying dcim.0075_cable_devices...
Updating cable device terminations...
 OK
  Applying dcim.0076_console_port_types... OK
  Applying dcim.0077_power_types... OK
  Applying dcim.0078_3569_site_fields... OK
  Applying dcim.0079_3569_rack_fields... OK
  Applying dcim.0080_3569_devicetype_fields... OK
  Applying dcim.0081_3569_device_fields... OK
  Applying dcim.0082_3569_interface_fields... OK
  Applying virtualization.0016_replicate_interfaces...
    Replicating 0 VM interfaces...
    Replicating assigned objects...
 OK
  Applying dcim.0082_3569_port_fields... OK
  Applying dcim.0083_3569_cable_fields... OK
  Applying dcim.0084_3569_powerfeed_fields... OK
  Applying dcim.0085_3569_poweroutlet_fields... OK
  Applying dcim.0086_device_name_nonunique... OK
  Applying dcim.0087_role_descriptions... OK
  Applying dcim.0088_powerfeed_available_power... OK
  Applying dcim.0089_deterministic_ordering... OK
  Applying dcim.0090_cable_termination_models... OK
  Applying dcim.0091_interface_type_other... OK
  Applying dcim.0092_fix_rack_outer_unit... OK
  Applying dcim.0093_device_component_ordering... OK
  Applying dcim.0094_device_component_template_ordering... OK
  Applying dcim.0095_primary_model_ordering... OK
  Applying dcim.0096_interface_ordering... OK
  Applying dcim.0097_interfacetemplate_type_other... OK
  Applying dcim.0098_devicetype_images... OK
  Applying dcim.0099_powerfeed_negative_voltage... OK
  Applying dcim.0100_mptt_remove_indexes... OK
  Applying dcim.0101_nested_rackgroups... OK
  Applying dcim.0102_nested_rackgroups_rebuild... OK
  Applying dcim.0103_standardize_description... OK
  Applying dcim.0104_correct_infiniband_types... OK
  Applying dcim.0105_interface_name_collation... OK
  Applying dcim.0106_role_default_color... OK
  Applying dcim.0107_component_labels... OK
  Applying dcim.0108_add_tags... OK
  Applying dcim.0109_interface_remove_vm... OK
  Applying dcim.0110_virtualchassis_name... OK
  Applying dcim.0111_component_template_description... OK
  Applying dcim.0112_standardize_components... OK
  Applying dcim.0113_nullbooleanfield_to_booleanfield... OK
  Applying dcim.0114_update_jsonfield... OK
  Applying dcim.0115_rackreservation_order... OK
  Applying dcim.0116_rearport_max_positions... OK
  Applying extras.0043_report... OK
  Applying extras.0044_jobresult... OK
  Applying extras.0045_configcontext_changelog... OK
  Applying extras.0046_update_jsonfield... OK
  Applying extras.0047_tag_ordering... OK
  Applying users.0001_api_tokens... OK
  Applying users.0002_unicode_literals... OK
  Applying users.0003_token_permissions... OK
  Applying users.0004_standardize_description... OK
  Applying users.0005_userconfig... OK
  Applying users.0006_create_userconfigs... OK
  Applying users.0007_proxy_group_user... OK
  Applying users.0008_objectpermission... OK
  Applying users.0009_replicate_permissions... OK
  Applying secrets.0007_secretrole_description... OK
  Applying secrets.0008_standardize_description... OK
  Applying secrets.0009_secretrole_drop_users_groups... OK
  Applying sessions.0001_initial... OK
  Applying taggit.0003_taggeditem_add_unique_index... OK
  Applying tenancy.0007_nested_tenantgroups... OK
  Applying tenancy.0008_nested_tenantgroups_rebuild... OK
  Applying tenancy.0009_standardize_description... OK
  Applying users.0010_update_jsonfield... OK
  Applying virtualization.0017_update_jsonfield... OK</pre>
<p>Crie seu usuário para o acesso web:</p>
<pre class="remontti-code"># python3 manage.py createsuperuser </pre>
<pre class="remontti-code-plain">Username (leave blank to use &#039;root&#039;): remontti
Email address: noc@remontti.com.br
Password: sua_senha
Password (again): sua_senha
Superuser created successfully</pre>
<pre class="remontti-code"># python3 manage.py collectstatic</pre>
<pre class="remontti-code-plain">979 static files copied to &#039;/opt/netbox/netbox/static&#039;.</pre>
<p>Vamos preparar nosso serviço web</p>
<pre class="remontti-code"># pip3 install gunicorn

# cat &lt;&lt;EOF | tee /opt/netbox/gunicorn_config.py
command = &#039;/usr/local/bin/gunicorn&#039;
pythonpath = &#039;/opt/netbox/netbox&#039;
bind = &#039;127.0.0.1:8001&#039;
workers = 3
user = &#039;www-data&#039;
EOF

# cat &lt;&lt;EOF | tee /etc/supervisor/conf.d/netbox.conf
[program:netbox]
command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
directory = /opt/netbox/netbox/
user = www-data
EOF

# systemctl restart supervisor</pre>
<p>Caso você não queira ter certificado e nem vai usar um domínio pode pular esta parte...<br />
Vou instalar o letsencrypt para gerar nosso certificado (pode preencher como quiser as perguntas). Caso queira instalar com um certificado "privado/invalido" <a href="https://netbox.readthedocs.io/en/stable/installation/5-http-server/" rel="noopener" target="_blank">veja aqui</a>.</p>
<pre class="remontti-code"># apt install letsencrypt python-certbot-nginx
# systemctl stop nginx
# letsencrypt --authenticator standalone --installer nginx -d netbox.remontti.com.br</pre>
<p>Crie um script para renomar o certificado automaticamente</p>
<pre class="remontti-code"># vim  /etc/renovassl.sh</pre>
<p>Adicione:</p>
<pre class="remontti-code">#!/bin/bash
# Para o nginx 
/usr/bin/systemctl stop nginx
# Aguarda 10 seg (tempo do nginx parar) 
sleep 10
# Renova o certificado
/usr/bin/certbot -q renew
# Aguarda o certificado renovar
sleep 30
# Restarta o nginx 
/usr/bin/systemctl restart nginx</pre>
<p>Altere as permissões para executa-lo e adicione o scrip ao cron para ser rodado todo dia 1º do mês. </p>
<pre class="remontti-code"># chmod +x /etc/renovassl.sh
# echo &#039;00 00   1 * *   root    /etc/renovassl.sh&#039; &gt;&gt; /etc/crontab
# systemctl restart cron</pre>
<p>Removemos o arquivo defautl do nosso servidor web (nginx), e iremos criar um novo, estou usando um domínio, caso esteja utilizando com IP privado apenas coloque um underline ou sei próprio IP. </p>
<pre class="remontti-code"># rm /etc/nginx/sites-enabled/default
# vim /etc/nginx/sites-available/netbox.conf</pre>
<p>Ajuste o diretório do seu certificado.  </p>
<pre class="remontti-code">server {
    listen 443 ssl;
    # Quiser limitar o acesso apenas a seus IPs
    #allow  192.168.1.0/24;
    #allow  2001:0db8::/32;
    #deny   all;
    #error_page  403   http://www.remontti.com.br;

    server_name netbox.remontti.com.br;

    ssl_certificate /etc/letsencrypt/live/netbox.remontti.com.br/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/netbox.remontti.com.br/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    client_max_body_size 25m;

    location /static/ {
        alias /opt/netbox/netbox/static/;
    }

    location / {
        proxy_pass http://localhost:8001;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

server {
    listen 80;
    server_name netbox.remontti.com.br;
    return 301 https://$host$request_uri;
}</pre>
<p>Ou a versão simplificada sem certificado, usando o seu endereço IP, se ainda assim deseja só usar o domínios basta colocar no lugar no IP.</p>
<pre class="remontti-code">server {
    listen 80;
    server_name 192.168.0.2;
    client_max_body_size 25m;

    location /static/ {
        alias /opt/netbox/netbox/static/;
    }

    location / {
        proxy_pass http://localhost:8001;
    }
}</pre>
<p>Remova assinatura do nginx (ninguém precisa saber a versão!)</p>
<pre class="remontti-code"># sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf</pre>
<p>Verifique se seu arquivo de configuração do nginx está correto:</p>
<pre class="remontti-code"># nginx -t</pre>
<pre class="remontti-code-plain">nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful</pre>
<p>Crie o atalho do arquivo de configuração dentro do diretório enabled para que o mesmo seja carregado ao restart o nginx.</p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/netbox.conf /etc/nginx/sites-enabled/
# systemctl restart nginx</pre>
<p>Agora acesse seu domínios <em>"https://netbox.remontti.com.br/"</em> ou <em>"https://ip/"</em> e entre com sua senha criada anteriormente.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-2.png" alt="" width="1680" height="914" class="alignnone size-full wp-image-5418" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-2.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-2-300x163.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-2-1024x557.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-2-768x418.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-2-1536x836.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /><br />
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-3.png" alt="" width="1680" height="982" class="alignnone size-full wp-image-5419" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-3.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-3-300x175.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-3-1024x599.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-3-768x449.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/03/netbox-3-1536x898.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></p>
<h3>PLUGINs</h3>
<p><strong>Netbox Topology Views</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views.png" data-rel="lightbox-gallery-CEzSzvYd" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views-300x149.png" alt="" width="300" height="149" class="alignnone size-medium wp-image-5446" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views-1536x764.png 1536w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-Topology-Views.png 1903w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
<a href="https://github.com/mattieserver/netbox-topology-views" rel="noopener" target="_blank">https://github.com/mattieserver/netbox-topology-views</a></p>
<p><strong>Netbox QR Code</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code.png" data-rel="lightbox-gallery-CEzSzvYd" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code-300x146.png" alt="" width="300" height="146" class="alignnone size-medium wp-image-5451" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code-300x146.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code-1024x497.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code-768x373.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code-1536x745.png 1536w, https://blog.remontti.com.br/wp-content/uploads/2021/03/Netbox-QR-Code-2048x994.png 2048w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
<a href="https://github.com/k01ek/netbox-qrcode" rel="noopener" target="_blank">https://github.com/k01ek/netbox-qrcode</a></p>
<pre class="remontti-code"># pip install netbox-topology-views
# pip install netbox-qrcode
# echo netbox-topology-views &gt;&gt; /opt/netbox/local_requirements.txt
# echo netbox-qrcode &gt;&gt; /opt/netbox/local_requirements.txt
# vim /opt/netbox/netbox/netbox/configuration.py</pre>
<p>Adicione:</p>
<pre class="remontti-code">PLUGINS = [&#039;netbox_topology_views&#039;,&#039;netbox_qrcode&#039;]

PLUGINS_CONFIG = {
  &#039;netbox_topology_views&#039;: {
    &#039;device_img&#039;: &#039;router,switch,firewall&#039;,
    &#039;preselected_device_roles&#039;: &#039;Router, Firewall&#039;,
    &#039;allow_coordinates_saving&#039;: False,
    &#039;ignore_cable_type&#039;: &#039;&#039;,
  },
  &#039;netbox_qrcode&#039;: {
    &#039;with_text&#039;: True,
    &#039;text_fields&#039;: [&#039;name&#039;, &#039;serial&#039;],
    &#039;font&#039;: &#039;ArialMT&#039;,
    &#039;custom_text&#039;: &#039;Remontti\ntel.00-000-000-000&#039;,
    &#039;qr_version&#039;: 1,
    &#039;qr_error_correction&#039;: 0,
    &#039;qr_box_size&#039;: 4,
    &#039;qr_border&#039;: 4,
    &#039;cable&#039;: None,
    &#039;rack&#039;: {
      &#039;text_fields&#039;: [
        &#039;site&#039;,
        &#039;name&#039;,
        &#039;tenant&#039;
      ]
    },
    &#039;device&#039;: {
      &#039;text_fields&#039;: [
        &#039;name&#039;,
        &#039;serial&#039;,
        &#039;tenant&#039;,
        &#039;primary_ip&#039;
      ]
    }
  }
}
</pre>
<p>Copiamos os arquivos empacotados estáticos e reiniciamos o supervisor (netbox).</p>
<pre class="remontti-code"># python3 /opt/netbox/netbox/manage.py collectstatic --no-input
# systemctl restart supervisor</pre>
<h3>COMO ATUALIZAR PARA FUTURAS VERSÕES</h3>
<p>Procure pela ultima atualização: <a href="https://github.com/netbox-community/netbox/releases" rel="noopener" target="_blank">https://github.com/netbox-community/netbox/releases</a>, e copie a url da versão tar.gz, no exemplo estou atualizando para versão 2.10.8, então preste atenção no nome dos diretórios.<br />
Vou baixar e extrair:</p>
<pre class="remontti-code"># cd /tmp/
# wget https://github.com/netbox-community/netbox/archive/refs/tags/v2.10.8.tar.gz
# tar -xzf v2.10.8.tar.gz</pre>
<p>Copie os arquivos de configuração para a versão mais nova, preste atenção nos nomes de diretórios que contém a versãi no ex. "2.10.8" para a versão que esteja atualizando.</p>
<pre class="remontti-code"># cp /opt/netbox/netbox/netbox/configuration.py /tmp/netbox-2.10.8/netbox/netbox/
# cp /opt/netbox/local_requirements.txt /tmp/netbox-2.10.8/
# cp /opt/netbox/gunicorn_config.py /tmp/netbox-2.10.8/</pre>
<p>Copie os arquivos que você enviou, exemplo fotos etc.</p>
<pre class="remontti-code"># cp -pr /opt/netbox/netbox/media/ /tmp/netbox-2.10.8/netbox/</pre>
<p>Além disso, certifique-se de copiar ou vincular quaisquer scripts e relatórios personalizados que você fez.</p>
<pre class="remontti-code"># cp -r /opt/netbox/netbox/scripts /opt/netbox/netbox/
# cp -r /opt/netbox/netbox/reports /opt/netbox/netbox/</pre>
<p>Renomeia o antigo diretório (Não vamos remover, pois se der ruim basta volta-lo)</p>
<pre class="remontti-code"># mv /opt/netbox /opt/netbox_`date +%Y%m%d`</pre>
<p>Movemos nosso diretório atualizado para /opt/netbox.</p>
<pre class="remontti-code"># mv /tmp/netbox-2.10.8/ /opt/netbox</pre>
<p>Finalizamos copiando os arquivos empacotados estáticos e reiniciamos o supervisor (netbox).</p>
<pre class="remontti-code"># python3 /opt/netbox/netbox/manage.py collectstatic --no-input
# systemctl restart supervisor</pre>
<p>Espero que tenha gostado!</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Participe do canal no <a href="https://t.me/blogremontti" rel="noopener noreferrer" target="_blank">telegram</a> para ficar atualizado sempre que publicar um novo tutorial. </p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Fonte:<br />
<a href="https://netbox.readthedocs.io/en/stable/installation" rel="noopener" target="_blank">https://netbox.readthedocs.io/en/stable/installation</a></p>
<p>O post <a href="https://blog.remontti.com.br/5412">Como instalar Netbox, ferramenta grátis para documentar sua rede</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5412/feed</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
			</item>
		<item>
		<title>Kimchi/Wok para gerenciamento de VM no Debian 9</title>
		<link>https://blog.remontti.com.br/1898</link>
					<comments>https://blog.remontti.com.br/1898#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Thu, 25 Oct 2018 14:06:30 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian9]]></category>
		<category><![CDATA[ginger]]></category>
		<category><![CDATA[hipervisor]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[libvirt]]></category>
		<category><![CDATA[libvirt-bin]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[realtek]]></category>
		<category><![CDATA[virtualização]]></category>
		<category><![CDATA[wok]]></category>
		<guid isPermaLink="false">http://blog.remontti.com.br/?p=1898</guid>

					<description><![CDATA[<p>Neste tutorial, faremos nosso próprio Hypervisor no Debian 9 instalando o KVM (Kernel-based Virtual Machine), assim como o Kimchi, que é uma plataforma de gerenciamento de virtualização baseada na web de código aberto para&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/1898">Kimchi/Wok para gerenciamento de VM no Debian 9</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Neste tutorial, faremos nosso próprio Hypervisor no Debian 9 instalando o KVM (Kernel-based Virtual Machine), assim como o <a href="https://github.com/kimchi-project/kimchi/" rel="noopener" target="_blank">Kimchi</a>, que é uma plataforma de gerenciamento de virtualização baseada na web de código aberto para que possamos gerenciar nosso hipervisor facilmente através do navegador da web.</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-debian9.png" alt="" width="717" height="387" class="alignnone size-full wp-image-2799" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-debian9.png 717w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-debian9-300x162.png 300w" sizes="auto, (max-width: 717px) 100vw, 717px" /></p>
<p><strong>Distribuição usada: Debian 9</strong> <a href="https://blog.remontti.com.br/1152" rel="noopener" target="_blank">(Instalação limpa)</a></p>
<p>Primeiramente vamos adicionar ao repositório os componentes <strong>contrib e non-free</strong></p>
<pre class="remontti-code">vim /etc/apt/sources.list</pre>
<pre class="remontti-code">
deb http://ftp.br.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.br.debian.org/debian/ stretch main contrib non-free

deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free

# stretch-updates, previously known as &#039;volatile&#039;
deb http://ftp.br.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://ftp.br.debian.org/debian/ stretch-updates main contrib non-free
</pre>
<p>Atualize o repositório e instale as atualizações.</p>
<pre class="remontti-code">apt update ; apt upgrade -y</pre>
<p>Instale os pacotes necessários.</p>
<pre class="remontti-code"># apt install firmware-linux-nonfree firmware-realtek nginx-full build-essential</pre>
<p>Reinicie para que o novo modulo do kernel seja interpretado.</p>
<pre class="remontti-code">reboot</pre>
<p>Baixe os pacotes necessários. (<a href="https://github.com/kimchi-project/kimchi/releases/latest" rel="noopener" target="_blank">https://github.com/kimchi-project/kimchi/releases/latest</a>)</p>
<pre class="remontti-code"># mkdir kimchi-project
# cd kimchi-project
# wget http://kimchi-project.github.io/gingerbase/downloads/latest/ginger-base.noarch.deb
# wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/wok-2.5.0-0.noarch.deb
# wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/kimchi-2.5.0-0.noarch.deb</pre>
<p>No Debian 9 o pacote libvirt-bin requisito não está mais presente, foram substituidos pelos libvirt-daemon-system, libvirt-dev, libvirt-clients. </p>
<p>Portanto vamos precisar abrir nosso pacote .DEB e altera-lo. Vamos &#8220;hackear&#8221; eles <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f61b.png" alt="😛" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
Vamos criar um diretório tmp e extrai-lo</p>
<pre class="remontti-code"># mkdir tmp
# cd tmp
# ar p ../kimchi-2.5.0-0.noarch.deb control.tar.gz | tar -xz</pre>
<p>Agora edite os arquivos controll &#038; controll.in alterando &#8220;libvirt-bin,&#8221; para &#8220;libvirt-daemon-system, libvirt-dev, libvirt-clients,&#8221;</p>
<pre class="remontti-code">vim controll</pre>
<p>Altere<br />
  <em>libvirt-bin,</em><br />
Por:<br />
<em>  libvirt-daemon-system,<br />
  libvirt-dev,<br />
  libvirt-clients,</em></p>
<pre class="remontti-code">
		Package: @PACKAGE_NAME@
		Version: @PACKAGE_VERSION@
		Section: base
		Priority: optional
		Architecture: all
		Depends: wok (&gt;= 2.1.0),
		         python-imaging,
		         python-configobj,
		         novnc,
		         python-jsonschema (&gt;= 1.3.0),
		         python-libvirt,
		         gettext,
-		         libvirt-bin,
+		         libvirt-daemon-system,
+		         libvirt-dev,
+		         libvirt-clients,
		         nfs-common,
		         qemu-kvm,
		         python-parted,
		         python-psutil (&gt;= 0.6.0),
		         python-ethtool,
		         sosreport,
		         python-ipaddr,
		         python-lxml,
		         open-iscsi,
		         python-guestfs,
		         libguestfs-tools,
		         spice-html5,
		         python-magic,
		         python-paramiko
		Build-Depends: xsltproc,
		               gettext,
		               python-lxml
		Maintainer: Aline Manera &lt;alinefm@br.ibm.com&gt;
		Description: Kimchi web application
</pre>
<p>Faça o mesmo para o controll.in</p>
<pre class="remontti-code"># vim controll.in</pre>
<p>Agora vamos empacota-lo novamente com o nome kimchi-2.5.0-0.deb9.noarch.deb</p>
<pre class="remontti-code"># cp ../kimchi-2.5.0-0.noarch.deb ../kimchi-2.5.0-0.deb9.noarch.deb
# tar czf control.tar.gz *[!z]
# ar r ../kimchi-2.5.0-0.deb9.noarch.deb control.tar.gz
# cd ..</pre>
<p>Verifique se o arquivo kimchi-2.5.0-0.deb9.noarch.deb foi criado</p>
<pre class="remontti-code"># ls -lh</pre>
<p>Vamos a instalação dos nossos arquivos .deb</p>
<pre class="remontti-code"># apt install ./wok-2.5.0-0.noarch.deb
# apt install ./ginger-base.noarch.deb
# apt install ./kimchi-2.5.0-0.deb9.noarch.deb</pre>
<p>Fix Bug erro KCHTMPL0020E / KCHIMG0001E<br />
Este é um bug na versão estável atual que ainda não foi corrigido, você verá o erro abaixo quando isso ocorrer.<br />
<em>KCHTMPL0020E: Unable to create template due error: KCHIMG0001E: Error probing image OS information: part_list: parted print: /dev/sda</em></p>
<p>Edite o arquivo templates.py (Se tiver dificuldade baixe o arquivo já alterado <a href="https://blog.remontti.com.br/wp-content/uploads/2018/10/templates.zip" rel="noopener" target="_blank">aqui</a> para visualizar)</p>
<pre class="remontti-code"># vim /usr/lib/python2.7/dist-packages/wok/plugins/kimchi/model/templates.py</pre>
<p>Remova a linha com &#8220;<strong>&#8211;</strong>&#8221; e adiciona a com &#8220;<strong>+</strong>&#8220;.</p>
<pre class="remontti-code">
[...]
-	-ISO_TYPE = &quot;ISO 9660 CD-ROM&quot;
+	+ISO_TYPE = [&quot;DOS/MBR&quot;, &quot;ISO 9660 CD-ROM&quot;]
[...]
	        # cdrom
-	        if ISO_TYPE in ftype:
+	        iscdrom = [t for t in ISO_TYPE if t in ftype]
+	        if iscdrom:
[...]
</pre>
<p>Reinicie</p>
<pre class="remontti-code"># reboot</pre>
<p>Abra em seu navegador a https://IP:8001. Acesse com seu usuário e senha do sistema (&#8220;root&#8221;).<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/10/Screenshot_20181025_103706.png" data-rel="lightbox-gallery-ejw3wqB5" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/10/Screenshot_20181025_103706-300x130.png" alt="" width="300" height="130" class="alignnone size-medium wp-image-2794" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/10/Screenshot_20181025_103706-300x130.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/10/Screenshot_20181025_103706-768x332.png 768w, https://blog.remontti.com.br/wp-content/uploads/2018/10/Screenshot_20181025_103706-1024x443.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/10/Screenshot_20181025_103706.png 1456w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-qemu-.jpg" data-rel="lightbox-gallery-ejw3wqB5" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-qemu--300x155.jpg" alt="" width="300" height="155" class="alignnone size-medium wp-image-2796" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-qemu--300x155.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-qemu--768x398.jpg 768w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-qemu--1024x530.jpg 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-qemu-.jpg 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Antes de criar a VM vc precisará criar um modelo, a ISO de sua VM deve ser salva em /var/lib/kimchi/isos/<br />
Exemplo baixando a ISO do Debina 9.5 Netinst</p>
<pre class="remontti-code"># wget -q http://ftp.br.debian.org/debian-cd/current/amd64/iso-cd/debian-9.5.0-amd64-netinst.iso -O /var/lib/kimchi/isos/</pre>
<p>A interface é bem intuitiva, acredito que não terá dificuldade.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-kvm.jpg" data-rel="lightbox-gallery-ejw3wqB5" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-kvm-300x155.jpg" alt="" width="300" height="155" class="alignnone size-medium wp-image-2797" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-kvm-300x155.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-kvm-768x397.jpg 768w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-kvm-1024x529.jpg 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/10/kimchi-kvm.jpg 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Para ativar a inicialização automática de uma VM ou desabilitar use os comandos:</p>
<pre class="remontti-code"># virsh autostart NomeVM
# virsh autostart NomeVM --disable</pre>
<p>Removendo Kimchi</p>
<pre class="remontti-code"># apt purge kimchi ginger-base build-essential nginx-full pep8 pyflakes python-requests python-mock wok libvirt* python-libvirt # qemu-*
# rm /var/lib/gingerbase/ -rf
# rm /var/lib/kimchi/ -rf
# rm /var/lib/libvirt/ -rf
# rm /etc/libvirt/ -rf
# apt autoremove</pre>
<p>Curtiu? Deixe seu comentário ficarei feliz em saber que lhe ajudei, e se tiver qualquer pergunta deixe-a também.</p>
<p>Fontes:<br />
<em>https://github.com/kimchi-project/kimchi</em><br />
<em>https://github.com/kimchi-project/kimchi/issues</em></p>
<p>O post <a href="https://blog.remontti.com.br/1898">Kimchi/Wok para gerenciamento de VM no Debian 9</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/1898/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
