<?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 lamp - Remontti</title>
	<atom:link href="https://blog.remontti.com.br/tag/lamp/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.remontti.com.br/tag/lamp</link>
	<description>rudimar@remontti</description>
	<lastBuildDate>Thu, 15 Jun 2023 17:34:40 +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 lamp - Remontti</title>
	<link>https://blog.remontti.com.br/tag/lamp</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Servidor WEB Apache2 + PHP 8.2 + MariaDB +Let’s Encrypt Debian 12 Bookworm (LAMP)</title>
		<link>https://blog.remontti.com.br/7496</link>
					<comments>https://blog.remontti.com.br/7496#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Sun, 11 Jun 2023 16:40:46 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administração de banco de dados.]]></category>
		<category><![CDATA[Ambiente de servidor]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[Autenticação de servidor]]></category>
		<category><![CDATA[bookworm]]></category>
		<category><![CDATA[Certificado SSL]]></category>
		<category><![CDATA[Configuração do Apache]]></category>
		<category><![CDATA[Configuração do servidor]]></category>
		<category><![CDATA[Debian 12]]></category>
		<category><![CDATA[Desenvolvimento web]]></category>
		<category><![CDATA[Gerenciamento de banco de dados]]></category>
		<category><![CDATA[Hospedagem web]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[Let’s Encrypt]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[PHP 8.2]]></category>
		<category><![CDATA[Proteção de dados]]></category>
		<category><![CDATA[Segurança na web]]></category>
		<category><![CDATA[Servidor WEB]]></category>
		<category><![CDATA[Versão do PHP]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=7496</guid>

					<description><![CDATA[<p>Distribuição utilizada: &#8211; Debian 12 Bookworm / Instalação Limpa Acesse seu bash e vire root com o comando su &#8211; para evitar comandos &#8220;que não existem&#8221;, e antes de mais nada tenha seu repositório&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/7496">Servidor WEB Apache2 + PHP 8.2 + MariaDB +Let’s Encrypt Debian 12 Bookworm (LAMP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><center><a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12.jpg" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img fetchpriority="high" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12.jpg" alt="" width="720" height="340" class="alignnone size-full wp-image-7503" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12.jpg 720w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12-300x142.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12-520x245.jpg 520w" sizes="(max-width: 720px) 100vw, 720px" /></a></center></p>
<p>Distribuição utilizada:<br />
&#8211; <strong><a href="https://blog.remontti.com.br/7236" rel="noopener noreferrer" target="_blank">Debian 12 Bookworm / Instalação Limpa</a></strong></p>
<p>Acesse seu bash e vire root com o comando su &#8211; para evitar comandos &#8220;que não existem&#8221;, e antes de mais nada tenha seu repositório atualizado.</p>
<pre class="remontti-code"># su -
# apt update
# apt upgrade</pre>
<h3>:: Instalação do Apache2 ::</h3>
<pre class="remontti-code"># apt install apache2 apache2-utils -y</pre>
<p>Após a instação, habilitamos o <strong>mod_rewrite</strong> do Apache que é muito utilizado. Este é um módulo que utiliza um mecanismo baseado em regras de reescrita. (phpipa, wordpress todos usam), e o <strong>mod_headers</strong> Este módulo fornece diretivas para controlar e modificar os cabeçalhos de solicitação e resposta HTTP. Comando para habilita-lo:</p>
<pre class="remontti-code"># a2enmod rewrite ; a2enmod headers</pre>
<p>A página que vimos ao abri o ip do nosso servidor no navegador fica no diretório /var/www/html, isso está sendo informado no arquivo default do apache que fica em /etc/apache2/sites-enabled/000-default.conf, e para que nosso mod_rewrite e headers funcione corretamente será necessário adicionar alguma linhas.<br />
O HTTP Strict Transport Security ou HSTS (RFC 6797) é um novo padrão de segurança SSL aprovado recentemente pelo IETF. Ele traz diversas melhorias para o SSL como forçar a utilização do HTTPS impedindo que sites sejam acessados usando o protocolo HTTP ou que partes do código de um site que está usando HTTPS seja executado em servidores usando o HTTP entre outras.</p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/000-default.conf</pre>
<p>Adicione abaixo de &#8220;DocumentRoot /var/www/html&#8221; o seguinte:</p>
<pre class="remontti-code">
	Header always set Strict-Transport-Security &quot;max-age=63072000; includeSubDomains&quot;

	&lt;Directory /var/www/html/&gt;
    		Options FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS-300x281.png" alt="" width="300" height="281" class="alignnone size-medium wp-image-6154" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS-300x281.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS-768x720.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS.png 1024w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Para você aprender mais como o apache funciona recomendo: <strong><a href="https://blog.remontti.com.br/3464" rel="noopener" target="_blank">Como ter diversos sub/domínios no mesmo servidor</a></strong></p>
<p>Por segurança remova a assinatura do apache e reinicie o apache2 para que tenha efeito as nossas alterações.</p>
<pre class="remontti-code"># sed -i &#039;s/ServerTokens OS/ServerTokens Prod/&#039; /etc/apache2/conf-available/security.conf
# sed -i &#039;s/ServerSignature On/ServerSignature Off/&#039; /etc/apache2/conf-available/security.conf
# systemctl restart apache2</pre>
<p><strong>http://[SERVER_IP]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-150x150.png" alt="" width="150" height="150" class="alignnone size-thumbnail wp-image-5897" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-150x150.png 150w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-80x80.png 80w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-320x320.png 320w" sizes="(max-width: 150px) 100vw, 150px" /></a></p>
<h3>:: Instalação do PHP 8.2 ::</h3>
<p>Para instalação do PHP vou incluir algumas extensões que são as mais utilizada, mas seu preferir você pode optar em não instalar, as necessárias são libapache2-mod-php php php-mysql php-cli.</p>
<pre class="remontti-code"># apt install libapache2-mod-php php php-mysql php-cli php-pear php-gmp php-gd php-bcmath php-mbstring php-curl php-xml php-zip -y</pre>
<p>É necessário reiniciar o apache para que o php tenha efeito.</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Consultado informações de versão:</p>
<pre class="remontti-code"># php --version</pre>
<pre class="remontti-code-plain">
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies
</pre>
<p>Você pode criar um arquivo php com a função <a href="https://php.net/manual/pt_BR/function.phpinfo.php" rel="noopener noreferrer" target="_blank">phpinfo()</a> para mostrar todas as informações.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo(); ?&gt;&#039; &gt; /var/www/html/phpinfo.php</pre>
<p><strong>http://[SERVER_IP]/phpinfo.php</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/debian12_php8.2.png" data-rel="lightbox-gallery-pnk6aqQp" 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></p>
<h3>:: Instalação do MariaDB 10.11 + phpMyAdmin 5 ::</h3>
<pre class="remontti-code"># apt install mariadb-server mariadb-client phpmyadmin</pre>
<p>Por padrão o pacote MaraiDB no Debian usa unix_socket para autenticar o login do usuário, o que basicamente significa que você pode usar o nome de usuário e a senha do sistema operacional para efetuar login no console do MariaDB. Assim, você pode logar diretamente sem fornecer a senha root do MariaDB. Mais a frente vou ensinar como definir uma senha, não farei agora pois se você alterar nesse momento ao instalar o phpMyAdmin terá um erro.</p>
<p>Selecione <strong>Apache2</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_1.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_1.png" alt="" width="1256" height="408" class="alignnone size-full wp-image-7499" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_1.png 1256w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_1-300x97.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_1-1024x333.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_1-768x249.png 768w" sizes="auto, (max-width: 1256px) 100vw, 1256px" /></a></p>
<p>Responda <strong>Sim</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_2.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_2.png" alt="" width="1257" height="513" class="alignnone size-full wp-image-7500" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_2.png 1257w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_2-300x122.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_2-1024x418.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_2-768x313.png 768w" sizes="auto, (max-width: 1257px) 100vw, 1257px" /></a></p>
<p><strong>Informe a senha</strong> para o banco de dados do phpmyadmin. <a href="http://senhasegura.remontti.com.br/" rel="noopener" target="_blank">http://senhasegura.remontti.com.br/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_3.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_3.png" alt="" width="1261" height="410" class="alignnone size-full wp-image-7501" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_3.png 1261w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_3-300x98.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_3-1024x333.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_3-768x250.png 768w" sizes="auto, (max-width: 1261px) 100vw, 1261px" /></a></p>
<p>Repita a senha<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_4.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_4.png" alt="" width="1264" height="437" class="alignnone size-full wp-image-7502" srcset="https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_4.png 1264w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_4-300x104.png 300w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_4-1024x354.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2023/06/lamp_debian_12_4-768x266.png 768w" sizes="auto, (max-width: 1264px) 100vw, 1264px" /></a></p>
<p>Para acessar o phpmyadmin:<strong>http://[SERVER_IP]/phpmyadmin/</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2023/06/phpmyadmin_login.png" data-rel="lightbox-gallery-pnk6aqQp" data-rl_title="" data-rl_caption="" title=""><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" /></a></p>
<p>Por segurança eu sempre fecho o acesso ao phpmyadmin para os IPs da administração, assim evito que uma possível vulnerabilidade venha me afetar. Para isso edite:</p>
<pre class="remontti-code"># vim /etc/phpmyadmin/apache.conf</pre>
<p>Se deseja deixar o atalho para o phpmyadmin restrito apenas aos seus IP de gerencia faça da seguinte forma. Lembre-se de alterar os IPs 200.200.200.0/26 2001:db8:cafe:d0ce::/64 para os seus.</p>
<pre class="remontti-code"># phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

&lt;Directory /usr/share/phpmyadmin&gt;
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    # Restrito aos IPs
    AllowOverride All
    Require ip 127.0.0.1 ::1 200.200.200.0/26 2001:db8:cafe:d0ce::/64

    # limit libapache2-mod-php to files and directories necessary by pma
    &lt;IfModule mod_php7.c&gt;
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
    &lt;/IfModule&gt;

    # PHP 8+
    &lt;IfModule mod_php.c&gt;
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
    &lt;/IfModule&gt;

&lt;/Directory&gt;

# Disallow web access to directories that don&#039;t need it
&lt;Directory /usr/share/phpmyadmin/templates&gt;
    Require all denied
&lt;/Directory&gt;
&lt;Directory /usr/share/phpmyadmin/libraries&gt;
    Require all denied
&lt;/Directory&gt;</pre>
<p>Reinicie o Apache.</p>
<pre class="remontti-code"> systemctl restart apache2</pre>
<h4>:: Definindo senha para o root do mariaDB ::</h4>
<p>Para aumentar a seguraçã vamos definir uma senha para o usuário root do MariDB, não esqueça de alterar <strong>ALTERE_3ST4_SENHA</strong> pela sua senha.</p>
<pre class="remontti-code"># mariadb -u root</pre>
<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>
<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-apache</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-pnk6aqQp" 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><br />
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></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>O post <a href="https://blog.remontti.com.br/7496">Servidor WEB Apache2 + PHP 8.2 + MariaDB +Let’s Encrypt Debian 12 Bookworm (LAMP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/7496/feed</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>Instalando WordPress em seu Servidor LAMP</title>
		<link>https://blog.remontti.com.br/6029</link>
					<comments>https://blog.remontti.com.br/6029#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Mon, 01 Nov 2021 14:58:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sites]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=6029</guid>

					<description><![CDATA[<p>O WordPress é um projeto de código aberto que você pode usar para criar sites, blogs ou aplicativos. O blog.remontti.com.br é feito com wordpress! Requisitos usados neste tutorial: &#8211; Distribuição: Instalação do Debian 11&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/6029">Instalando WordPress em seu Servidor LAMP</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/11/WordPress-Logo-300x169.png" alt="" width="300" height="169" class="alignnone size-medium wp-image-6032" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/WordPress-Logo-300x169.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/WordPress-Logo-1024x576.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/11/WordPress-Logo-768x432.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/11/WordPress-Logo-1536x864.png 1536w, https://blog.remontti.com.br/wp-content/uploads/2021/11/WordPress-Logo-2048x1152.png 2048w" sizes="auto, (max-width: 300px) 100vw, 300px" /></p>
<p>O <a href="https://br.wordpress.org/" rel="noopener" target="_blank"><strong>WordPress</strong></a> é um projeto de código aberto que você pode usar para criar sites, blogs ou aplicativos. O <a href="https://blog.remontti.com.br/" rel="noopener" target="_blank">blog.remontti.com.br</a> é feito com wordpress!</p>
<h4>Requisitos usados neste tutorial:</h4>
<p><strong>&#8211; Distribuição:</strong><br />
<a href="https://blog.remontti.com.br/5792" rel="noopener" target="_blank">Instalação do Debian 11 ou 10</a></p>
<p><strong>&#8211; Aplicações Web Apache + PHP7.x + MariaDB:</strong><br />
<a href="https://blog.remontti.com.br/5893" rel="noopener" target="_blank">Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin + Let’s Encrypt no Debian 11 bullseye “LAMP”</a></p>
<p><strong>&#8211; Conhecimento em domínios virtuais:</strong><br />
<a href="https://blog.remontti.com.br/3464" rel="noopener" target="_blank">Como ter diversos sub/domínios no mesmo servidor? (Domínios virtuais com Apache2)</a></p>
<p><strong>&#8211; Aponte seu domínio/subdomínio no seu servidor DNS </strong><br />
<a href="https://blog.remontti.com.br/5958" rel="noopener" target="_blank">Servidor DNS Bind9 – Recursivo + Autoritativo DNSSEC + Reverso + RPZ + Fail2ban + nftables + Zabbix no Debian 11 Bullseye</a></p>
<h4>Modelo de configuração Apache</h4>
<p>Como exemplo usarei: <em>blog.remontti.com.br</em></p>
<pre class="remontti-code"># vim /etc/apache2/sites-available/blog.remontti.com.br.conf</pre>
<pre class="remontti-code-plain">&lt;virtualhost *:80&gt;
        ServerName blog.remontti.com.br
        ServerAdmin noc@remontti.com.br
 
        DocumentRoot /var/www/blog.remontti.com.br
 
        &lt;directory /var/www/blog.remontti.com.br/ &gt;
                Options FollowSymLinks
                AllowOverride All
        &lt;/directory&gt; 
 
        LogLevel warn 
        ErrorLog ${APACHE_LOG_DIR}/error_blog.remontti.com.br.conf.log
        CustomLog ${APACHE_LOG_DIR}/access_blog.remontti.com.br.conf.log combined
&lt;/virtualhost&gt;</pre>
<pre class="remontti-code"># mkdir /var/www/blog.remontti.com.br/
# a2ensite blog.remontti.com.br.conf
# systemctl restart apache2</pre>
<h4>Pacotes necessários</h4>
<pre class="remontti-code"># apt install wget unzip</pre>
<h4>Instalando WordPress</h4>
<p>Acesse o diretório temporário do linux e baixe o WordPress</p>
<pre class="remontti-code"># cd /tmp/
# wget https://br.wordpress.org/latest-pt_BR.zip
# unzip latest-pt_BR.zip
# cd wordpress/</pre>
<p>Agora mova todos os arquivos para o diretório correspondente a seu domínio/sub.</p>
<pre class="remontti-code"># mv * /var/www/blog.remontti.com.br/</pre>
<p>Altere as permissões do diretório e todos os arquivos para o usuario do apache (www-data)</p>
<pre class="remontti-code"># chown www-data. /var/www/blog.remontti.com.br/ -R</pre>
<p>Agora crie seu banco de dados, para isso acesse com usuário root e vamos criar um novo banco chamado wordpress bem como um usuário para o wordpress, assim nosso &#8220;site&#8221; fica preso a este usuário, não seja &#8220;expertão&#8221; de me usar o root para a conexão do wordpress!</p>
<pre class="remontti-code"># mariadb -u root -p </pre>
<p>Não esqueça de alterar: SUA_SENHA</p>
<pre class="remontti-code-plain">CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO &#039;wordpress&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUA_SENHA&#039;;
FLUSH PRIVILEGES;
quit;</pre>
<h5>Seguimos agora com a instalação via web</h5>
<p><strong>Acessar seu domínio</strong>: &#8220;http://blog.remontti.com.br/&#8221; e clique em <strong>Vamos lá!</strong></p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao.png" alt="" width="895" height="642" class="alignnone size-full wp-image-6035" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao.png 895w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao-300x215.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao-768x551.png 768w" sizes="auto, (max-width: 895px) 100vw, 895px" /></p>
<p>Preencha os dados de acordo com as <strong>configurações do banco de dados</strong> criadas anteriormente:</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf.png" alt="" width="868" height="644" class="alignnone size-full wp-image-6036" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf.png 868w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf-300x223.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf-768x570.png 768w" sizes="auto, (max-width: 868px) 100vw, 868px" /></p>
<p>Clique em <strong>Instalar</strong></p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf1.png" alt="" width="838" height="296" class="alignnone size-full wp-image-6038" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf1.png 838w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf1-300x106.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf1-768x271.png 768w" sizes="auto, (max-width: 838px) 100vw, 838px" /></p>
<p>Preencha os dados do seu &#8220;site&#8221; bem como usuários para posteriormente acessar o painel de ADM e clique em <strong>Instalar WordPress</strong></p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf2.png" alt="" width="868" height="887" class="alignnone size-full wp-image-6039" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf2.png 868w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf2-294x300.png 294w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf2-768x785.png 768w" sizes="auto, (max-width: 868px) 100vw, 868px" /></p>
<p>Parabéns <strong>WordPress instalado com sucesso!</strong>, clieque em <strong>Acessar</strong> para entrar no painel de ADM.</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf3.png" alt="" width="909" height="426" class="alignnone size-full wp-image-6040" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf3.png 909w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf3-300x141.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf3-768x360.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf3-520x245.png 520w" sizes="auto, (max-width: 909px) 100vw, 909px" /></p>
<p>Entre com usuário e senha da instalação.</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf4.png" alt="" width="916" height="502" class="alignnone size-full wp-image-6041" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf4.png 916w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf4-300x164.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf4-768x421.png 768w" sizes="auto, (max-width: 916px) 100vw, 916px" /></p>
<p>Pronto!</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf5.png" alt="" width="1916" height="946" class="alignnone size-full wp-image-6042" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf5.png 1916w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf5-300x148.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf5-1024x506.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf5-768x379.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/11/wordpress_instalacao_conf5-1536x758.png 1536w" sizes="auto, (max-width: 1916px) 100vw, 1916px" /></p>
<p>Sempre que desejar entrar no painel basta acessar: http://seudominio.x.y<strong>/wp-admin</strong></p>
<p>Espero que tenha gosta deste tutorial, ele fugiu um pouco dos temas abordados mas muitas pessoas me pedem. </p>
<p>Você encontrar centenas de videos no <a href="https://www.youtube.com/results?search_query=Whwordpress+tutorial+aprenda" rel="noopener" target="_blank">youtube ensinado a mexer com wordpress</a>. Conheço muitos amigos que ganham $$ fazendo sites com WordPress, bons estudos!</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>O post <a href="https://blog.remontti.com.br/6029">Instalando WordPress em seu Servidor LAMP</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/6029/feed</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin + Let&#8217;s Encrypt no Debian 11 bullseye &#8220;LAMP&#8221;</title>
		<link>https://blog.remontti.com.br/5893</link>
					<comments>https://blog.remontti.com.br/5893#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 20 Oct 2021 15:01:11 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Segurança]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Bullseye]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 11]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php7.4]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5893</guid>

					<description><![CDATA[<p>Distribuição utilizada: Debian 11 Bullseye / Instalação Limpa Acesse seu bash e vire root com o comando su &#8211; para evitar comandos &#8220;que não existem&#8221;, e antes de mais nada tenha seu repositório atualizado.&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5893">Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin + Let&#8217;s Encrypt no Debian 11 bullseye &#8220;LAMP&#8221;</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/debian_11_lamp.png" alt="" width="790" height="374" class="alignnone size-full wp-image-5909" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/debian_11_lamp.png 790w, https://blog.remontti.com.br/wp-content/uploads/2021/10/debian_11_lamp-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/debian_11_lamp-768x364.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/debian_11_lamp-520x245.png 520w, https://blog.remontti.com.br/wp-content/uploads/2021/10/debian_11_lamp-720x340.png 720w" sizes="auto, (max-width: 790px) 100vw, 790px" /><br />
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>
<p>Acesse seu bash e vire root com o comando su &#8211; para evitar comandos &#8220;que não existem&#8221;, e antes de mais nada tenha seu repositório atualizado.</p>
<pre class="remontti-code"># su -
# apt update
# apt upgrade</pre>
<h3>:: Instalação do Apache ::</h3>
<pre class="remontti-code"># apt install apache2 apache2-utils</pre>
<p>Após a instação, habilitamos o <strong>mod_rewrite</strong> do Apache que é muito utilizado. Este é um módulo que utiliza um mecanismo baseado em regras de reescrita. (phpipa, wordpress todos usam), e o <strong>mod_headers</strong> Este módulo fornece diretivas para controlar e modificar os cabeçalhos de solicitação e resposta HTTP. Comando para habilita-lo:</p>
<pre class="remontti-code"># a2enmod rewrite
# a2enmod headers</pre>
<p>A página que vimos ao abri o ip do nosso servidor no navegador fica no diretório /var/www/html, isso está sendo informado no arquivo default do apache que fica em /etc/apache2/sites-enabled/000-default.conf, e para que nosso mod_rewrite e headers funcione corretamente será necessário adicionar alguma linhas.<br />
O HTTP Strict Transport Security ou HSTS (RFC 6797) é um novo padrão de segurança SSL aprovado recentemente pelo IETF. Ele traz diversas melhorias para o SSL como forçar a utilização do HTTPS impedindo que sites sejam acessados usando o protocolo HTTP ou que partes do código de um site que está usando HTTPS seja executado em servidores usando o HTTP entre outras.</p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/000-default.conf</pre>
<p>Adicione abaixo de &#8220;DocumentRoot /var/www/html&#8221; o seguinte:</p>
<pre class="remontti-code">
	Header always set Strict-Transport-Security &quot;max-age=63072000; includeSubDomains&quot;

	&lt;Directory /var/www/html/&gt;
    		Options FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS.png" data-rel="lightbox-gallery-moqvHT3a" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS-300x281.png" alt="" width="300" height="281" class="alignnone size-medium wp-image-6154" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS-300x281.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS-768x720.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache_HSTS.png 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Para você aprender mais como o apache funciona recomendo: <strong><a href="https://blog.remontti.com.br/3464" rel="noopener" target="_blank">Como ter diversos sub/domínios no mesmo servidor</a></strong></p>
<p>Por segurança remova a assinatura do apache e reinicie o apache2 para que tenha efeito as nossas alterações.</p>
<pre class="remontti-code"># sed -i &#039;s/ServerTokens OS/ServerTokens Prod/&#039; /etc/apache2/conf-available/security.conf
# sed -i &#039;s/ServerSignature On/ServerSignature Off/&#039; /etc/apache2/conf-available/security.conf
# systemctl restart apache2</pre>
<p><strong>http://[SERVER_IP]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2.png" data-rel="lightbox-gallery-moqvHT3a" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-150x150.png" alt="" width="150" height="150" class="alignnone size-thumbnail wp-image-5897" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-150x150.png 150w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-80x80.png 80w, https://blog.remontti.com.br/wp-content/uploads/2021/10/apache2-320x320.png 320w" sizes="auto, (max-width: 150px) 100vw, 150px" /></a></p>
<h3>:: Instalação do MariaDB 10.5 ::</h3>
<pre class="remontti-code"># apt install mariadb-server mariadb-client </pre>
<p>Por padrão o pacote MaraiDB no Debian usa unix_socket para autenticar o login do usuário, o que basicamente significa que você pode usar o nome de usuário e a senha do sistema operacional para efetuar login no console do MariaDB.<br />
Assim, você pode logar diretamente sem fornecer a senha root do MariaDB. Mais a frente vou ensinar como definir uma senha, não farei agora pois se você alterar nesse momento ao instalar o phpMyAdmin terá um erro.</p>
<h3>:: Instalação do PHP 7.4 ::</h3>
<p>Para instalação do PHP vou incluir algumas extensões que são as mais utilizada, mas seu preferir você pode optar em não instalar, as necessárias são libapache2-mod-php php php-mysql php-cli.</p>
<pre class="remontti-code"># apt install libapache2-mod-php php php-mysql php-cli php-pear php-gmp php-gd php-bcmath php-mbstring php-curl php-xml php-zip</pre>
<p>É necessário reiniciar o apache para que o php tenha efeito.</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Consultado informações de versão:</p>
<pre class="remontti-code"># php --version</pre>
<pre class="remontti-code-plain">PHP 7.4.21 (cli) (built: Jul  2 2021 03:59:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies</pre>
<p>Você pode criar um arquivo php com a função <a href="https://php.net/manual/pt_BR/function.phpinfo.php" rel="noopener noreferrer" target="_blank">phpinfo()</a> para mostrar todas as informações.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo(); ?&gt;&#039; &gt; /var/www/html/phpinfo.php</pre>
<p><strong>http://[SERVER_IP]/phpinfo.php</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/php7.png" data-rel="lightbox-gallery-moqvHT3a" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/php7-150x150.png" alt="" width="150" height="150" class="alignnone size-thumbnail wp-image-5896" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/php7-150x150.png 150w, https://blog.remontti.com.br/wp-content/uploads/2021/10/php7-80x80.png 80w, https://blog.remontti.com.br/wp-content/uploads/2021/10/php7-320x320.png 320w" sizes="auto, (max-width: 150px) 100vw, 150px" /></a></p>
<h3>:: phpMyAdmin ::</h3>
<p>Adivinha quem voltou para o repositório? Sim! phpmyadmin está de volta!</p>
<pre class="remontti-code"># apt install phpmyadmin</pre>
<p>Selecione <strong>Apache2</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_1.png" alt="" width="1047" height="299" class="alignnone size-full wp-image-5899" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_1.png 1047w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_1-300x86.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_1-1024x292.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_1-768x219.png 768w" sizes="auto, (max-width: 1047px) 100vw, 1047px" /></p>
<p><strong>Sim</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_2.png" alt="" width="1648" height="363" class="alignnone size-full wp-image-5900" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_2.png 1648w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_2-300x66.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_2-1024x226.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_2-768x169.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_2-1536x338.png 1536w" sizes="auto, (max-width: 1648px) 100vw, 1648px" /></p>
<p><strong>Informe a senha</strong> para o banco de dados do phpmyadmin. <a href="http://senhasegura.remontti.com.br/" rel="noopener" target="_blank">http://senhasegura.remontti.com.br/</a></p>
<p>Aguarde finalizar&#8230; <font color="blue"><strong>Se você é um menino que seguiu a risca não vai ter o erro seguinte, então pode pular esta parte.</strong></font></p>
<p><font color="red"><strong>POSSÍVEL ERRO!</strong><br />
Este erro acontece quando o usuário root do mariaDB está com senha. Caso isso acontecer, selecione <strong>IGNORAR</strong> e siga os passos a baixo.</font><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_4.png" alt="" width="900" height="758" class="alignnone size-full wp-image-5902" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_4.png 900w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_4-300x253.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_4-768x647.png 768w" sizes="auto, (max-width: 900px) 100vw, 900px" /><br />
<font color="red">SE OCORRER O ERRO: SIGAS ESTES PASSOS PARA RESOLUÇÃO DO PROBLEMA ACIMA.</font><br />
<font color="red">Como o usuário root já tem senha e o script de instalção não sabe qual é a senha ele ele acaba apresentando esse erro ao criar o banco de dados bem como as tabelas do phpmyadmin, então vamos ter que criar na mão.<br />
Se você quiser certificar qual a senha digitou na instalação do phpmyadmin basta olhar o arquivo:</font></p>
<pre class="remontti-code"># vim /etc/phpmyadmin/config-db.php</pre>
<pre class="remontti-code-plain">$dbuser=&#039;phpmyadmin&#039;;
$dbpass=&#039;SUPER_SENHA&#039;;
$basepath=&#039;&#039;;
$dbname=&#039;phpmyadmin&#039;;
$dbserver=&#039;localhost&#039;;
$dbport=&#039;3306&#039;;
$dbtype=&#039;mysql&#039;;</pre>
<p><font color="red">Agora entre no mariadb e vamos criar o banco bem como o usuário phpmyadmin <em>(Use a mesma senha que está no config-db.php, ou altere também no config-db.php)</em></font></p>
<pre class="remontti-code"># mariadb -u root -p </pre>
<p><font color="red">Não esqueça de alterar a SUPER_SENHA.</font></p>
<pre class="remontti-code">CREATE DATABASE phpmyadmin;
CREATE USER &#039;phpmyadmin&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUPER_SENHA&#039;;
GRANT ALL PRIVILEGES ON phpmyadmin.* TO &#039;phpmyadmin&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUPER_SENHA&#039; WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;</pre>
<p>Importe as tabelas:</p>
<pre class="remontti-code"># mariadb -u root -p phpmyadmin &lt; /usr/share/phpmyadmin/sql/create_tables.sql</pre>
<p><font color="red">Pronto erro solucionado!</font></p>
<hr />
<p>Para acessar o phpmyadmin:<strong>http://[SERVER_IP]/phpmyadmin/</strong><br />
Caso seu phpmyadmin não abrir, certifique-se que o arquivo phpmyadmin.conf está lincado em /etc/apache2/conf-enabled/</p>
<pre class="remontti-code"># ls -lh /etc/apache2/conf-available/ | grep phpmyadmin.conf</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_apache_debian_11.png" alt="" width="991" height="93" class="alignnone size-full wp-image-5999" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_apache_debian_11.png 991w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_apache_debian_11-300x28.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_apache_debian_11-768x72.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_apache_debian_11-980x93.png 980w" sizes="auto, (max-width: 991px) 100vw, 991px" /><br />
<font color="red">Caso não esteja execute o comando, e reinicie o apache:</font></p>
<pre class="remontti-code"># ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
# systemctl restart apache2</pre>
<p>Agora tente novamente.,</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_5.png" data-rel="lightbox-gallery-moqvHT3a" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_5-150x150.png" alt="" width="150" height="150" class="alignnone size-thumbnail wp-image-5905" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_5-150x150.png 150w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_5-80x80.png 80w, https://blog.remontti.com.br/wp-content/uploads/2021/10/phpmyadmin_debian_11_5-320x320.png 320w" sizes="auto, (max-width: 150px) 100vw, 150px" /></a></p>
<p>Por segurança eu sempre fecho o acesso ao phpmyadmin para os IPs da administração, assim evito que uma possível vulnerabilidade venha me afetar. Para isso edite:</p>
<pre class="remontti-code"># vim /etc/phpmyadmin/apache.conf</pre>
<p>Se deseja deixar o atalho para o phpmyadmin restrito apenas aos seus IP de gerencia faça da seguinte forma. Lembre-se de alterar os IPs 200.200.200.0/26 2001:db8:cafe:d0ce::/64 para os seus.</p>
<pre class="remontti-code"># phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

&lt;Directory /usr/share/phpmyadmin&gt;
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    AllowOverride All
    Require ip 127.0.0.1 ::1 200.200.200.0/26 2001:db8:cafe:d0ce::/64

    # limit libapache2-mod-php to files and directories necessary by pma
    &lt;IfModule mod_php7.c&gt;
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
    &lt;/IfModule&gt;

&lt;/Directory&gt;

# Disallow web access to directories that don&#039;t need it
&lt;Directory /usr/share/phpmyadmin/templates&gt;
    Require all denied
&lt;/Directory&gt;
&lt;Directory /usr/share/phpmyadmin/libraries&gt;
    Require all denied
&lt;/Directory&gt;</pre>
<p>Reinicie o Apache.</p>
<pre class="remontti-code"> systemctl restart apache2</pre>
<h4>:: Definindo senha para o root do mariaDB ::</h4>
<p>Para aumentar a seguraçã vamos definir uma senha para o usuário root do MariDB, não esqueça de alterar <strong>ALTERE_3ST4_SENHA</strong> pela sua senha.</p>
<pre class="remontti-code"># mariadb -u root</pre>
<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"># echo &gt; /root/.mysql_history</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-apache</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-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-moqvHT3a" 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><br />
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></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>O post <a href="https://blog.remontti.com.br/5893">Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin + Let&#8217;s Encrypt no Debian 11 bullseye &#8220;LAMP&#8221;</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5893/feed</wfw:commentRss>
			<slash:comments>11</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-hMwypzNf" 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-wuAwjWwy" 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>Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin no Debian 10 Buster &#8220;LAMP&#8221;</title>
		<link>https://blog.remontti.com.br/3006</link>
					<comments>https://blog.remontti.com.br/3006#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Tue, 16 Jul 2019 19:05:12 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[buster]]></category>
		<category><![CDATA[debian 10]]></category>
		<category><![CDATA[debian buster]]></category>
		<category><![CDATA[debian10]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=3006</guid>

					<description><![CDATA[<p>Distribuição utilizada: Debian 10 Stretch / Instalação Limpa Vale lembrar que desde o Debian 9 o PHP foi atualizado para a versão 7 e agora para 7.3, e o MySQL foi substituído pelo seu&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/3006">Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin no Debian 10 Buster &#8220;LAMP&#8221;</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/2019/07/debian10-lamp.jpg" alt="" width="800" height="376" class="alignnone size-full wp-image-3028" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/debian10-lamp.jpg 800w, https://blog.remontti.com.br/wp-content/uploads/2019/07/debian10-lamp-300x141.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2019/07/debian10-lamp-768x361.jpg 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/debian10-lamp-520x245.jpg 520w" sizes="auto, (max-width: 800px) 100vw, 800px" /><br />
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><br />
Vale lembrar que desde o Debian 9 o PHP foi atualizado para a versão 7 e agora para 7.3, e o MySQL foi substituído pelo seu fork MariaBD<br />
Antes de mais nada tenha seu repositório atualizado</p>
<pre class="remontti-code"># su -
# apt update
# apt upgrade</pre>
<h3>:: Instalação do Apache 2.4 ::</h3>
<pre class="remontti-code"># apt install apache2 apache2-utils</pre>
<p>Vamos habilitar o mod_rewrite do Apache que é muito utilizado.<br />
Este é um módulo do Apache que utiliza um mecanismo baseado em regras de reescrita.<br />
Vamos ao comando para habilita-lo:</p>
<pre class="remontti-code"># a2enmod rewrite</pre>
<p>A página que vimos ao abri o ip do nosso servidor no navegador fica no diretório /var/www/html, isso está sendo informado no arquivo default do apache que fica em /etc/apache2/sites-enabled/000-default.conf, e para que nosso mod_rewrite funcione corretamente será necessário adicionar alguma linhas.</p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/000-default.conf</pre>
<p>Adicione abaixo de &#8220;DocumentRoot /var/www/html&#8221; o seguinte:</p>
<pre class="remontti-code">	&lt;Directory /var/www/html/&gt;
    		Options FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/apache2-deb10-rewrite.png" data-rel="lightbox-gallery-wtS4WRYc" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/apache2-deb10-rewrite-300x251.png" alt="" width="300" height="251" class="alignnone size-medium wp-image-3012" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/apache2-deb10-rewrite-300x251.png 300w, https://blog.remontti.com.br/wp-content/uploads/2019/07/apache2-deb10-rewrite-768x642.png 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/apache2-deb10-rewrite.png 887w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Agora precisamos restartar o apache2 para que tenha efeito as alterações.</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>http://[SERVER_IP]/<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/apache-debian-10-buster.png" data-rel="lightbox-gallery-wtS4WRYc" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/apache-debian-10-buster-230x300.png" alt="" width="230" height="300" class="alignnone size-medium wp-image-3010" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/apache-debian-10-buster-230x300.png 230w, https://blog.remontti.com.br/wp-content/uploads/2019/07/apache-debian-10-buster-768x1003.png 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/apache-debian-10-buster-784x1024.png 784w, https://blog.remontti.com.br/wp-content/uploads/2019/07/apache-debian-10-buster.png 941w" sizes="auto, (max-width: 230px) 100vw, 230px" /></a><br />
Por segurança remova a assinatura do apache.</p>
<pre class="remontti-code"># sed -i &#039;s/ServerTokens OS/ServerTokens Prod/&#039; /etc/apache2/conf-available/security.conf
# sed -i &#039;s/ServerSignature On/ServerSignature Off/&#039; /etc/apache2/conf-available/security.conf</pre>
<h3>:: Instalação do MariaDB 10.3 ::</h3>
<pre class="remontti-code"># apt install mariadb-server mariadb-client </pre>
<p>Por padrão o pacote MaraiDB no Debian usa unix_socket para autenticar o login do usuário, o que basicamente significa que você pode usar o nome de usuário e a senha do sistema operacional para efetuar login no console do MariaDB.<br />
Assim, você pode logar diretamente sem fornecer a senha root do MariaDB. Mas isso é estranho, pois minha senha do root do MariaDB é diferente do meu usuário unix.<br />
Bom se você é meio paranoico com segurança, para alterar a senha do usuário root do MariaDB de forma bruta faça o seguinte:</p>
<pre class="remontti-code"># mariadb -u root</pre>
<pre class="remontti-code">USE mysql;
UPDATE user SET password=PASSWORD(&#039;SENHA.db.ROOT&#039;) WHERE User=&#039;root&#039;;
UPDATE user SET plugin=&quot;mysql_native_password&quot;;
FLUSH PRIVILEGES;
quit;</pre>
<h3>:: Instalação do PHP 7.3 ::</h3>
<p>Vou incluir algumas extensões do PHP que são normalmente utilizada</p>
<pre class="remontti-code"># apt install libapache2-mod-php php php-mysql php-cli php-pear php-gmp php-gd php-bcmath php-mbstring php-curl php-xml php-zip</pre>
<p>É necessário reiniciar o apache para que o php tenha efeito.</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Consultado informações de versão:</p>
<pre class="remontti-code"># php --version</pre>
<pre class="remontti-code">PHP 7.3.4-2 (cli) (built: Apr 13 2019 19:05:48) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.4-2, Copyright (c) 1999-2018, by Zend Technologies</pre>
<p>Você pode criar um arquivo php com a função <a href="https://php.net/manual/pt_BR/function.phpinfo.php" rel="noopener noreferrer" target="_blank">phpinfo()</a> para mostrar todas as informações.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo(); ?&gt;&#039; &gt; /var/www/html/phpinfo.php</pre>
<p>http://[SERVER_IP]/phpinfo.php<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpinfo-debian-10-buster.png" data-rel="lightbox-gallery-wtS4WRYc" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpinfo-debian-10-buster-300x261.png" alt="" width="300" height="261" class="alignnone size-medium wp-image-3018" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpinfo-debian-10-buster-300x261.png 300w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpinfo-debian-10-buster-768x668.png 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpinfo-debian-10-buster.png 994w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<h3>:: phpMyAdmin ::</h3>
<p>Cade ele do repositório?<br />
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</pre>
<p>Escolha qual versão do irá utilizar phpMyAdmin 5.x.x ou 4.x.x</p>
<pre class="remontti-code"># cd /tmp/</pre>
<p>Para <strong>phpMyAdmin 5</strong> (06/04/2020)</p>
<pre class="remontti-code"># wget https://files.phpmyadmin.net/phpMyAdmin/5.0.4/phpMyAdmin-5.0.4-all-languages.tar.gz
# tar -vxzf phpMyAdmin-5.0.4-all-languages.tar.gz -C /usr/share/
# mv /usr/share/phpMyAdmin-5.0.4-all-languages /usr/share/phpmyadmin</pre>
<p>Para <strong>phpMyAdmin 4</strong> (06/04/2020)</p>
<pre class="remontti-code"># wget https://files.phpmyadmin.net/phpMyAdmin/4.9.5/phpMyAdmin-4.9.5-all-languages.tar.gz
# tar -vxzf phpMyAdmin-4.9.5-all-languages.tar.gz -C /usr/share/
# mv /usr/share/phpMyAdmin-4.9.5-all-languages /usr/share/phpmyadmin</pre>
<p>Seguimos para <strong>phpMyAdmin 5 ou 4</strong> </p>
<pre class="remontti-code"># mkdir /etc/phpmyadmin
# touch /etc/phpmyadmin/htpasswd.setup
# mkdir -p /var/lib/phpmyadmin/tmp
# chown www-data. /var/lib/phpmyadmin/ -R</pre>
<p>Criaremos o arquivo de configuração do Apache.</p>
<pre class="remontti-code"># vim /etc/apache2/conf-available/phpmyadmin.conf</pre>
<pre class="remontti-code"># phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

&lt;Directory /usr/share/phpmyadmin&gt;
 Options FollowSymLinks
 DirectoryIndex index.php

 &lt;IfModule mod_php7.c&gt;
 AddType application/x-httpd-php .php

 php_flag magic_quotes_gpc Off
 php_flag track_vars On
 php_flag register_globals Off
 php_value include_path .
 &lt;/IfModule&gt;

&lt;/Directory&gt;

# Authorize for setup
&lt;Directory /usr/share/phpmyadmin/setup&gt;
 &lt;IfModule mod_authn_file.c&gt;
 AuthType Basic
 AuthName &quot;phpMyAdmin Setup&quot;
 AuthUserFile /etc/phpmyadmin/htpasswd.setup
 &lt;/IfModule&gt;
 Require valid-user
&lt;/Directory&gt;

# Disallow web access to directories that don&#039;t need it
&lt;Directory /usr/share/phpmyadmin/libraries&gt;
 Order Deny,Allow
 Deny from All
&lt;/Directory&gt;
&lt;Directory /usr/share/phpmyadmin/setup/lib&gt;
 Order Deny,Allow
 Deny from All
&lt;/Directory&gt;</pre>
<p>Se deseja deixar o atalho para o phpmyadmin restrito apenas aos seus IP de gerencia faça da seguinte forma. Lembre-se de alterar os IPs 200.200.200.0/26 2001:db8:cafe:d0ce::/64 para os seus.</p>
<pre class="remontti-code"># phpMyAdmin default Apache configuration
 
Alias /phpmyadmin /usr/share/phpmyadmin
 
&lt;Directory /usr/share/phpmyadmin&gt;
 Options FollowSymLinks
 DirectoryIndex index.php

 AllowOverride All
 Require ip 127.0.0.1 ::1 200.200.200.0/26 2001:db8:cafe:d0ce::/64

 &lt;IfModule mod_php7.c&gt;
 AddType application/x-httpd-php .php
 
 php_flag magic_quotes_gpc Off
 php_flag track_vars On
 php_flag register_globals Off
 php_value include_path .
 &lt;/IfModule&gt;
 
&lt;/Directory&gt;
 
# Authorize for setup
&lt;Directory /usr/share/phpmyadmin/setup&gt;
 AllowOverride All
 Require ip 127.0.0.1 ::1 200.200.200.0/26 2001:db8:cafe:d0ce::/64
 &lt;IfModule mod_authn_file.c&gt;
 AuthType Basic
 AuthName &quot;phpMyAdmin Setup&quot;
 AuthUserFile /etc/phpmyadmin/htpasswd.setup
 &lt;/IfModule&gt;
 Require valid-user
&lt;/Directory&gt;
 
# Disallow web access to directories that don&#039;t need it
&lt;Directory /usr/share/phpmyadmin/libraries&gt;
 AllowOverride All
 Require ip 127.0.0.1 ::1 200.200.200.0/26 2001:db8:cafe:d0ce::/64
 Order Deny,Allow
 Deny from All
&lt;/Directory&gt;
&lt;Directory /usr/share/phpmyadmin/setup/lib&gt;
 AllowOverride All
 Require ip 127.0.0.1 ::1 200.200.200.0/26 2001:db8:cafe:d0ce::/64
 Order Deny,Allow
 Deny from All
&lt;/Directory&gt;
</pre>
<p>Ative a configuração e reinicie o Apache.</p>
<pre class="remontti-code"># a2enconf phpmyadmin
# systemctl restart apache2
# systemctl status apache2</pre>
<p>Na próxima etapa, vamos configurar o armazenamento de configuração do phpMyadmin (banco de dados).<br />
Faça o login no MariaDB como usuário root:</p>
<pre class="remontti-code"># mariadb -p</pre>
<p>Criamos um novo banco de dados para o chamado phpmyadmin e um usuario pma (altere para sua senha). Em seguida, concedemos as permissões do banco de dados.<br />
Você pode gerar uma senha acessando <a href="https://senhasegura.remontti.com.br/" rel="noopener noreferrer" target="_blank">https://senhasegura.remontti.com.br/</a></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>Carregue as tabelas do banco de dados: (Informe a senha do root do MariaDB)</p>
<pre class="remontti-code"># mariadb -u root -p phpmyadmin &lt; /usr/share/phpmyadmin/sql/create_tables.sql</pre>
<p>Agora é necessário ajustar o arquivo de configuração do phpmyadmin.<br />
Definir:<br />
* senha segura (blowfish secret) que deve ter 32 caracteres. Não use o meu exemplo blowfish secreto, defina o seu próprio! Use o gerador <a href="https://senhasegura.remontti.com.br" rel="noopener noreferrer" target="_blank">https://senhasegura.remontti.com.br</a><br />
* diretório que o PHPMyAdmin deve usar para armazenar arquivos temporários.<br />
* Descomentar as linhas $cfg['Servers']<br />
- controlhost : localhost<br />
- controlpass : SUA_SENHA</p>
<pre class="remontti-code"># cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
# vim /usr/share/phpmyadmin/config.inc.php</pre>
<pre class="remontti-code">$cfg[&#039;blowfish_secret&#039;] = &#039;dkJhGx83XR3JjuFrDn8kPp9NtXnkLptl&#039;;
/* Adicione esta linha */
$cfg[&#039;TempDir&#039;] = &#039;/var/lib/phpmyadmin/tmp&#039;;

/* 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;;

/* 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><a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster.png" data-rel="lightbox-gallery-wtS4WRYc" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-300x296.png" alt="" width="300" height="296" class="alignnone size-medium wp-image-3021" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-300x296.png 300w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-768x757.png 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster.png 901w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
http://[SERVER_IP]/phpmyadmin/<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-1.png" data-rel="lightbox-gallery-wtS4WRYc" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-1-300x155.png" alt="" width="300" height="155" class="alignnone size-medium wp-image-3022" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-1-300x155.png 300w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-1-768x397.png 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-1-1024x530.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-1.png 1680w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-2.png" data-rel="lightbox-gallery-wtS4WRYc" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-2-300x156.png" alt="" width="300" height="156" class="alignnone size-medium wp-image-3023" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-2-300x156.png 300w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-2-768x399.png 768w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-2-1024x532.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2019/07/phpmyadmin-debian-10-buster-2.png 1680w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Gostou?</p>
<p><center><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></center></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>O post <a href="https://blog.remontti.com.br/3006">Passo-a-passo como criar um servidor WEB Apache + PHP + MariaDB + phpMyAdmin no Debian 10 Buster &#8220;LAMP&#8221;</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/3006/feed</wfw:commentRss>
			<slash:comments>70</slash:comments>
		
		
			</item>
		<item>
		<title>Passo-a-passo como criar um servidor web Apache2, PHP 7.0, MariaDB, PHPMyAdmin &#8220;LAMP&#8221; no Debian 9 Stretch</title>
		<link>https://blog.remontti.com.br/2024</link>
					<comments>https://blog.remontti.com.br/2024#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Mon, 19 Jun 2017 18:55:38 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[Debian 9]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP 7.0]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[Stretch]]></category>
		<category><![CDATA[webserver]]></category>
		<guid isPermaLink="false">http://blog.remontti.com.br/?p=2024</guid>

					<description><![CDATA[<p>Distribuição utilizada: Debian 9 Stretch / Instalação Limpa Com o lançamento do Debian 9 alguns pacotes foram substituído como: PHP5 -> PHP7.0 Mysql -> MariaDB (MariaDB é um banco de dados que surgiu como&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/2024">Passo-a-passo como criar um servidor web Apache2, PHP 7.0, MariaDB, PHPMyAdmin &#8220;LAMP&#8221; no Debian 9 Stretch</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/2017/06/webdev-debian9.jpg" alt="" width="800" height="376" class="alignnone size-full wp-image-2046" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/webdev-debian9.jpg 800w, https://blog.remontti.com.br/wp-content/uploads/2017/06/webdev-debian9-300x141.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/webdev-debian9-768x361.jpg 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/webdev-debian9-520x245.jpg 520w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>
<p>Distribuição utilizada: Debian 9 Stretch / <a href="https://blog.remontti.com.br/1152">Instalação Limpa</a></p>
<p>Com o lançamento do Debian 9 alguns pacotes foram substituído como:<br />
<strong>PHP5 -> PHP7.0</strong><br />
<strong>Mysql -> <a href="https://pt.wikipedia.org/wiki/MariaDB" target="_blank" rel="noopener noreferrer">MariaDB</a></strong> (<em>MariaDB é um banco de dados que surgiu como fork do MySQL, criado pelo próprio fundador do projeto após sua aquisição pela Oracle.</em>)</p>
<p>Vamos a instalação</p>
<pre class="remontti-code"># apt update
# apt upgrade
# apt install apache2 libapache2-mod-php7.0 php7.0 mariadb-client mariadb-server phpmyadmin</pre>
<p>Instale todos os pacotes dependentes. (S)</p>
<p><em>OBS: Se você instalar o pacote <strong>mysql-server</strong> ele vai estar instalando o mariadb-client mariadb-server.</em></p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143240.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143240-300x199.png" alt="" width="300" height="199" class="alignnone size-medium wp-image-2028" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143240-300x199.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143240-768x509.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143240-1024x679.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143240.png 1192w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Na próxima tela selecione a opção apache2.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143756.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143756-300x199.png" alt="" width="300" height="199" class="alignnone size-medium wp-image-2029" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143756-300x199.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143756-768x509.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143756-1024x679.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_143756.png 1192w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Configurando o banco do phpmyadmin:<br />
Responda Sim.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144016.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144016-300x199.png" alt="" width="300" height="199" class="alignnone size-medium wp-image-2030" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144016-300x199.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144016-768x509.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144016-1024x679.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144016.png 1192w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Defina uma senha para a base do phpmyadmin:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144112.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144112-300x199.png" alt="" width="300" height="199" class="alignnone size-medium wp-image-2031" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144112-300x199.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144112-768x509.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144112-1024x679.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144112.png 1192w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Repita a senha:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144154.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144154-300x199.png" alt="" width="300" height="199" class="alignnone size-medium wp-image-2032" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144154-300x199.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144154-768x509.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144154-1024x679.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144154.png 1192w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Instalação concluída!<br />
Acesse <strong>http://ip-do-seu-servidor/</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150403.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150403-300x158.png" alt="" width="300" height="158" class="alignnone size-medium wp-image-2039" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150403-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150403-768x403.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150403-1024x538.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150403.png 1680w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p><strong>Não sentiu que faltou algo nessa instalação?</strong><br />
<strong>Sim!</strong> No MySQL você definia uma senha para para o usuário root do mysql na instalação, com o MariaDB isso não acontece pois ele vem sem senha de root! Como usuário root não tem senha você não vai conseguir logar com ele no PHPMyAdmin.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144650.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144650-202x300.png" alt="" width="202" height="300" class="alignnone size-medium wp-image-2034" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144650-202x300.png 202w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_144650.png 432w" sizes="auto, (max-width: 202px) 100vw, 202px" /></a></p>
<p>Para alterar a senha do usuário root do MariaDB faça:</p>
<pre class="remontti-code"># mariadb -u root</pre>
<pre class="remontti-code">USE mysql;
UPDATE user SET password=PASSWORD(&#039;SUA-SENHA&#039;) WHERE User=&#039;root&#039;;
UPDATE user SET plugin=&quot;mysql_native_password&quot;;
FLUSH PRIVILEGES;
quit;</pre>
<p>Mas não se assuste! MariaDB é praticamente o seu velho MySQL. Para saber mais acesse: <a href="https://mariadb.com/kb/pt-br/mariadb-versus-mysql-compatibility/" target="_blank" rel="noopener noreferrer">MariaDB versus MySQL &#8211; Compatibilidade</a>. Veja pelo lado bom, não permitindo login com root temos mais segurança!<br />
O que fazer então? Simples crie uma base de dados e um usuário para acessa-la. Eu sempre recomendei usar para cada aplicação um usuário com a sua base, assim numa falha você  não deixa exposto o que não deveria!<br />
Acesse via linha de comando nosso o mariadb (o comando mysql -p funciona também) </p>
<pre class="remontti-code"># mariadb -p</pre>
<p>Por padrão vem sem senha.</p>
<pre class="remontti-code">CREATE DATABASE minhabase;
GRANT ALL PRIVILEGES ON minhabase.* TO &#039;meuusuario&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;minhasenha&#039;;
FLUSH PRIVILEGES;
quit;</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_145812.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_145812-300x106.png" alt="" width="300" height="106" class="alignnone size-medium wp-image-2035" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_145812-300x106.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_145812-768x271.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_145812-1024x362.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_145812.png 1157w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Agora pode acessar seu PHPMyAdmin com seu seu usuário e senha. <strong>http://ip-do-seu-servidor/phpmyadmin</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150017.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150017-300x157.png" alt="" width="300" height="157" class="alignnone size-medium wp-image-2036" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150017-300x157.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150017-768x402.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150017-1024x536.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150017.png 1680w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150027.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150027-300x158.png" alt="" width="300" height="158" class="alignnone size-medium wp-image-2037" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150027-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150027-768x404.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150027-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150027.png 1680w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Agora vamos habilitar o <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html">mod_rewrite</a> do Apache que é muito utilizado. Este é um módulo do Apache que utiliza um mecanismo baseado em regras de reescrita.</p>
<p>Diretório de configurações do Apache fica em <strong>/etc/apache2/</strong></p>
<p>Vamos ao comando para habilita-lo:</p>
<pre class="remontti-code"># a2enmod rewrite</pre>
<p>A página que vimos ao abri o ip do nosso servidor no navegador fica no diretório /var/www/html, isso está sendo informado no arquivo default do apache que fica em <em>/etc/apache2/sites-enabled/000-default.conf</em>, e para que nosso <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html">mod_rewrite</a> funcione corretamente será necessário adicionar alguma linhas.</p>
<p>Edite o arquivo /etc/apache2/sites-enabled/000-default.conf (vou usar o editor vim, que não vem instalado por padrão no sistema, mas se você pode usar qualquer edito ex o nano)</p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/000-default.conf</pre>
<p>Adicione abaixo de &#8220;<span style="color: #000080;"><strong>DocumentRoot /var/www/html</strong>&#8220;</span> o seguinte:</p>
<pre class="remontti-code">	
	&lt;Directory /var/www/html/&gt;
    		Options FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;
</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150942.png" data-rel="lightbox-gallery-CMA4MP1q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150942-300x172.png" alt="" width="300" height="172" class="alignnone size-medium wp-image-2042" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150942-300x172.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150942-768x441.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150942-1024x588.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/06/Screenshot_20170619_150942.png 1192w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Por segurança recomendo remover a assinatura do servidor, evitando os &#8220;espertinhos&#8221;</p>
<pre class="remontti-code"># sed -i &#039;s/ServerTokens OS/ServerTokens Prod/&#039; /etc/apache2/conf-available/security.conf
# sed -i &#039;s/ServerSignature On/ServerSignature Off/&#039; /etc/apache2/conf-available/security.conf</pre>
<p>Agora precisamos restartar o apache para que tenha efeito nossas alterações.</p>
<pre class="remontti-code"># /etc/init.d/apache2 restart</pre>
<p>Ou</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Parabéns seu servidor está &#8220;Pronto&#8221;!</p>
<p>O post <a href="https://blog.remontti.com.br/2024">Passo-a-passo como criar um servidor web Apache2, PHP 7.0, MariaDB, PHPMyAdmin &#8220;LAMP&#8221; no Debian 9 Stretch</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/2024/feed</wfw:commentRss>
			<slash:comments>47</slash:comments>
		
		
			</item>
		<item>
		<title>Criando uma maquina virtual com linux (Debian) para Desenvolvedores Web (LDAMPS)</title>
		<link>https://blog.remontti.com.br/1730</link>
					<comments>https://blog.remontti.com.br/1730#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Mon, 20 Feb 2017 02:08:28 +0000</pubDate>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SFTP]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xamp]]></category>
		<category><![CDATA[xampp]]></category>
		<guid isPermaLink="false">http://blog.remontti.com.br/?p=1730</guid>

					<description><![CDATA[<p>LDAMPS (Linux / DNS / Apache / MySQL / PHP / SFTP) A ideia deste tutorial é criar um cenário mais legal que um simples &#8220;xampp/easyphp&#8221;, e sim criar nosso próprio &#8220;servidor de hospedagem&#8221;&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/1730">Criando uma maquina virtual com linux (Debian) para Desenvolvedores Web (LDAMPS)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong></strong><strong>LDAMPS</strong> (Linux / DNS / Apache / MySQL / PHP / SFTP)</p>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/web-dev-icon.jpg" alt="" width="800" height="510" class="alignnone size-full wp-image-1764" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/web-dev-icon.jpg 800w, https://blog.remontti.com.br/wp-content/uploads/2017/02/web-dev-icon-300x191.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/web-dev-icon-768x490.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>
<p>A ideia deste tutorial é criar um cenário mais legal que um simples &#8220;xampp/easyphp&#8221;, e sim criar nosso próprio &#8220;servidor de hospedagem&#8221; onde vamos criar domínios virtuais quais poderemos acessá-los para fazer simulações em cima de ambientes mais reais. </p>
<p>Para crianção da maquina virtual no VirtualBox e a Instalação do Debian siga os tutoriais abaixo.</p>
<p><a href="https://blog.remontti.com.br/1134" target="_blank" rel="noopener">Criando uma máquina virtual no Virtual Box</a></p>
<p>Na instalação, na parte da configuração não é necessário fixar um IP, pode recebe-lo automaticamente via DHCP, assim se você sair da sua rede pode levar a experiência para outras redes, porém será necessário alterar o endereço IP nas configurações do bind cada vez que seu servidor receber um novo IP, falarei disso nas configurações do BIND (é apenas um arquivo nada d+).</p>
<p><a href="https://blog.remontti.com.br/1152" target="_blank" rel="noopener">Instalação do Debian 8 Jessie Limpa passo-a-passo</a></p>
<p>Após instalação do Debina, instalaremos o SSH para acessamos remotamente via Terminal ou com Putty (Windows). Vou ainda instalar o editor vim, que é meu preferido, mas você pode usar nano, pico entre outros.</p>
<pre class="remontti-code"># apt install ssh vim</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_46_54.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_46_54-300x167.png" alt="" width="300" height="167" class="alignnone size-medium wp-image-1735" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_46_54-300x167.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_46_54.png 720w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Lembre-se que no processo da criação da maquina virtual nossa placa de rede ficou em modo bridge, ou seja isso faz com que a comunicação existente em sua rede seja de ponto-a-ponto entre todos que nela estão conectados.</p>
<p>Sempre que iniciar sua máquina virtual será necessário verificar qual IP recebeu. </p>
<pre class="remontti-code"># ifconfig </pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_52_46.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_52_46-300x167.png" alt="" width="300" height="167" class="alignnone size-medium wp-image-1736" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_52_46-300x167.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/VirtualBox_Debian-Dev-Web_19_02_2017_15_52_46.png 720w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
No meu caso minha maquina está com o IP 10.0.0.109. Agora vamos acessar nosso servidor por SSH, se você já utiliza linux abra em seu terminal e digite $ ssh seuusuario@ip-do-seu-servidor ou abra o Putty e informe o IP do seu servidor.<br />
Entre com sua senha, e após vire administrador (root) com o comando #su<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_155718.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_155718-300x201.png" alt="" width="300" height="201" class="alignnone size-medium wp-image-1737" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_155718-300x201.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_155718-768x515.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_155718.png 842w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Tem duas coisar que sempre faço após instalar um debian, faça se desejar.<br />
A primeira é colorir o bash.</p>
<pre class="remontti-code"># vim /root/.bashrc</pre>
<p>Descomente </p>
<pre class="remontti-code">
export LS_OPTIONS=&#039;--color=auto&#039;
eval &quot;`dircolors`&quot;
alias ls=&#039;ls $LS_OPTIONS&#039;
alias ll=&#039;ls $LS_OPTIONS -l&#039;
alias l=&#039;ls $LS_OPTIONS -lha&#039;
</pre>
<p>Insira ao final:</p>
<pre class="remontti-code">
PS1=&#039;${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]@\[\033[01;36m\]\h\[\033[00m\]:\[\033[01;37m\]\w\[\033[01;32m\]\$\[\033[00m\] &#039;
</pre>
<p>Deslogue do root <em>(# exit)</em>, e logue novamente <em>(# su)</em><br />
Pronto nosso bash está com &#8220;mais vida&#8221; <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>Você encontra mais detalhes em: <a href="https://blog.remontti.com.br/141" target="_blank" rel="noopener">Colorindo seu Bash</a></p>
<p>A segunda é melhorar o autocomplete:<br />
<a href="https://blog.remontti.com.br/1318" target="_blank" rel="noopener">Bash com autocomplete “turbinado” no Debian</a></p>
<p>Precisamos instalar nosso servidor web, para isso siga o tutorial abaixo.</p>
<p><a href="https://blog.remontti.com.br/1296" target="_blank" rel="noopener">Passo-a-passo como criar um servidor web Apache2, PHP5, MySQL, PHPMyAdmin “LAMP” no Debian 8</a></p>
<p>Agora vem a parte legal!! Configurar nosso servidor para resolver nomes (Sevidor DNS) e nele configurar alguns domínios &#8220;fake&#8221; quais poderemos acessar.<br />
<font color="red"><br />
<i>Vale lembrar que você não deve fazer isso em uma máquina com IP válido, caso fizer isso vai estar deixando consultas recursivas aberta para o mundo &#8220;escravizar-lo&#8221;, não vou entrar em detalhes das configurações avançadas do bind, o intuito aqui é ensinar pessoas a ter um cenário para programação web, em um ambiente local. Se deseja saber como configurar um servidor DNS acesse:</font> <a href="https://blog.remontti.com.br/1397">Servidor DNS Recursivo, Autoritativo e Reverso com Bind9 (IPv4+IPv6)</a>. </i></p>
<p>No exemplo vou inventar dois domínios fake:<br />
dominio1.com.br<br />
dominio2.com.br</p>
<p>Instalaremos o <a href="https://pt.wikipedia.org/wiki/BIND" target="_blank" rel="noopener">BIND</a> </p>
<pre class="remontti-code"># apt install bind9</pre>
<p>Altere o DNS do seus servidor para ele mesmo</p>
<pre class="remontti-code"># echo &#039;nameserver 127.0.0.1&#039; &gt; /etc/resolv.conf
</pre>
<p>Para prevenir que o DHCP não mude novamente seu DNS vamos alterar um configuração no arquivo de configuração do DHCP Cliente. Assim sempre vamos receber o 127.0.0.1</p>
<pre class="remontti-code"># sed -i &quot;s/#prepend domain-name-servers/prepend domain-name-servers/g&quot; /etc/dhcp/dhclient.conf</pre>
<p>Se quiser garantia que irá receber o 127.0.0.1 de um reboot em sua VM, e após reiniciar de um cat /etc/resolv.conf e veja se  <em>nameserver 127.0.0.1</em> se encontra no arquivo.</p>
<pre class="remontti-code"># reboot</pre>
<p>Vamos criar nossa zona fake, que fará com que todos os domínios que adicionaremos nela o servidor faça responder que o domínios é o seu próprio servidor. </p>
<pre class="remontti-code"># echo &#039;include &quot;/etc/bind/fakes.zone&quot;;&#039; &gt;&gt; /etc/bind/named.conf.local

# echo &#039;zone &quot;web.local&quot; IN { type master; file &quot;/etc/bind/db.web.local&quot;; };&#039; &gt;&gt; /etc/bind/named.conf.local</pre>
<pre class="remontti-code"># vim /etc/bind/db.web.local </pre>
<p><font color="red">Lembrando que 10.0.0.109 é o IP que estou recebendo via DHCP, SEMPRE que sua interface receber um novo IP será necessário altera-lo, e  restartar o serviço bind9.</font></p>
<pre class="remontti-code">
$ORIGIN .
$TTL 86400
web.local         IN SOA  ns1.web.local. ns2.web.local. (
                        2017021901 ; serial
                        28800      ; refresh (8 hours)
                        1800       ; retry (30 minutes)
                        2419200    ; expire (4 weeks)
                        10800      ; minimum (3 hours)
                        )
                        NS web.local
                        A 10.0.0.109
</pre>
<p>Vou ensinar como fazer script (shell script) que fará com que sempre fique o IP recebido via DHCP.<br />
Insira no final do arquivo /etc/rc.local as linhas abaixo, o rc.local é carregado na inicialização.</p>
<pre class="remontti-code"># vim /etc/rc.local</pre>
<p>Insira antes de exit 0</p>
<pre class="remontti-code">
pegaip=$(ifconfig eth0 | grep &quot;inet end&quot; | awk &#039;{print $3}&#039;)
sed -i &quot;s/ A .*/ A $pegaip/g&quot; /etc/bind/db.web.local
/etc/init.d/bind9  restart
</pre>
<p>Criaremos nosso arquivo fakes.zone quais adicionaremos os domínios fake.</p>
<p># vim /etc/bind/fakes.zone</p>
<pre class="remontti-code">
zone &quot;fakes.zone&quot; {
        type master;
        file &quot;/etc/bind/db.fakes.zone&quot;;
        allow-query {none;};
};
</pre>
<pre class="remontti-code"># vim /etc/bind/db.fakes.zone</pre>
<pre class="remontti-code">
$TTL 1H
@       IN      SOA LOCALHOST. NS.LOCALHOST (
                        2017021900      ; Serial  
                        1h              ; Refresh
                        15m             ; Retry
                        30d             ; Expire 
                        2h              ; Negative Cache TTL
                )
                NS  LOCALHOST.

*.dominio1.com.br       IN CNAME .
dominio1.com.br         IN CNAME .

*.dominio2.com.br       IN CNAME .
dominio2.com.br         IN CNAME .

</pre>
<pre class="remontti-code"># vim /etc/bind/named.conf.options</pre>
<p>Insira no arquivo antes de fechar a chave options.</p>
<pre class="remontti-code">response-policy {
	zone &quot;fakes.zone&quot; policy CNAME web.local;
};</pre>
<p>Ficando assim:</p>
<pre class="remontti-code">
options {
        directory &quot;/var/cache/bind&quot;;

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0 s placeholder.

        // forwarders {
        //      0.0.0.0;
        // };


        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================
        dnssec-validation auto;

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };

        response-policy {
                zone &quot;fakes.zone&quot; policy CNAME web.local;
        };
};
</pre>
<p>Restarte o bind toda vez que fizer alguma alteração (ex adicionar um novo domínio)</p>
<pre class="remontti-code"># /etc/init.d/bind9  restart</pre>
<p>Ping para seus domínios e veja se responde o IP do seu servidor.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_180743.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_180743-300x201.png" alt="" width="300" height="201" class="alignnone size-medium wp-image-1734" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_180743-300x201.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_180743-768x515.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_180743.png 842w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Altere os DNS de seu computador para o IP do seu servidor &#8220;no meu caso 10.0.0.109&#8221;. Seu computador vai fazer as consultas DNS em seu servidor, qual responde como autoritativo pelos domínios fakes. Agora Acesse seus domínios em seu navegador.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_183202.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_183202-300x213.png" alt="" width="300" height="213" class="alignnone size-medium wp-image-1745" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_183202-300x213.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_183202-768x544.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_183202-1024x726.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_183202.png 1043w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Recebemos a tela padrão, que esta é o arquivo que está em /var/www/html/index.html<br />
Como padrão então já sabemos que o diretório padrão do apaches (www-data) é /var/www/html/. Bom precisamos fazer nosso apache interpretar que cada site fique em um diretório diferente. Então vamos criar esses diretórios.</p>
<pre class="remontti-code"># mkdir -p /var/www/dom_fakes/dominio1.com.br
# mkdir /var/www/dom_fakes/dominio2.com.br</pre>
<p>Agora criamos nossos 2 arquivos de configurações em /etc/apache2/sites-enabled/ para cada domínio.</p>
<p><strong>dominio1.com.br</strong></p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/dominio1.com.br.conf</pre>
<pre class="remontti-code">&lt;VirtualHost *:80&gt;
	ServerName dominio1.com.br
	ServerAlias www.dominio1.com.br

        ServerAdmin seu@email.com.br
        DocumentRoot /var/www/dom_fakes/dominio1.com.br
	&lt;Directory /var/www/dom_fakes/dominio1.com.br/&gt;
    		Options Indexes FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;

	LogLevel warn

        ErrorLog ${APACHE_LOG_DIR}/dominio1.com.br_error.log
        CustomLog ${APACHE_LOG_DIR}/dominio1.com.br_access.log combined

&lt;/VirtualHost&gt;</pre>
<p><strong>dominio2.com.br</strong></p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/dominio2.com.br.conf</pre>
<pre class="remontti-code">&lt;VirtualHost *:80&gt;
	ServerName dominio2.com.br
	ServerAlias www.dominio2.com.br
        ServerAdmin seu@email.com.br
        DocumentRoot /var/www/dom_fakes/dominio2.com.br

	&lt;Directory /var/www/dom_fakes/dominio2.com.br/&gt;
    		Options Indexes FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;

	LogLevel warn

        ErrorLog ${APACHE_LOG_DIR}/dominio2.com.br_error.log
        CustomLog ${APACHE_LOG_DIR}/dominio2.com.br_access.log combined

&lt;/VirtualHost&gt;</pre>
<p>Criamos um arquivo em cada diretório para que possamos visualizar que estamos acessando o domínio corretamente.</p>
<pre class="remontti-code"># echo &gt; /var/www/dom_fakes/dominio1.com.br/d1.html
# echo &gt; /var/www/dom_fakes/dominio2.com.br/d2.html</pre>
<p>Agora restart o apache.</p>
<pre class="remontti-code"># /etc/init.d/apache2 restart</pre>
<p>Bingo!<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184336.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184336-300x230.png" alt="" width="300" height="230" class="alignnone size-medium wp-image-1747" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184336-300x230.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184336.png 750w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184339.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184339-300x230.png" alt="" width="300" height="230" class="alignnone size-medium wp-image-1748" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184339-300x230.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_184339.png 750w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Vamos remover o /var/www/html/index.html e criar um link dos domínios fakes em /var/www/html/ assim quando você não quiser trocar o IP para resolver nomes, você pode acessar o http://IP/dominiofake&#8230;. </p>
<pre class="remontti-code"># rm /var/www/html/index.html 
# ln -s /var/www/dom_fakes/ /var/www/html/</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133530.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133530-300x203.png" alt="" width="300" height="203" class="alignnone size-medium wp-image-1800" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133530-300x203.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133530-768x520.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133530.png 912w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133757.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133757-300x203.png" alt="" width="300" height="203" class="alignnone size-medium wp-image-1804" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133757-300x203.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133757-768x520.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170221_133757.png 912w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Para enviarmos os arquivos podemos usar um cliente SFTP como o FileZilla, Winscp entre outros. Mas para logar no nosso cliente SFTP vamos ter que fazer alguns ajustes no usuário www-data (usuário do apache), primeiramente ele não vem com permissão para logar, vale lembrar que eu não recomendo faze isso em servidores convencionais, este é um ambiente de &#8220;local&#8221; para estudos&#8230; </p>
<pre class="remontti-code"># usermod -s /bin/bash www-data</pre>
<p>Sete uma senha para o usuário www-data com o comando. (Vamos usar ela para logar posteriormente no FileZilla)</p>
<pre class="remontti-code"># passwd www-data</pre>
<p>Altere as permissões do diretório/subdir em /var/www para seu usuário www-data</p>
<pre class="remontti-code"># chown  www-data. /var/www/ -R</pre>
<p>Agora basta você conectar-se para enviar os arquivos: (ex. FileZilla)<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223559.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223559-300x242.png" alt="" width="300" height="242" class="alignnone size-medium wp-image-1757" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223559-300x242.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223559-768x619.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223559.png 789w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223836.png" data-rel="lightbox-gallery-8w8a99Ld" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223836-300x236.png" alt="" width="300" height="236" class="alignnone size-medium wp-image-1761" srcset="https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223836-300x236.png 300w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223836-768x604.png 768w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223836-1024x805.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2017/02/Screenshot_20170219_223836.png 1164w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Se você deseja arriscar e elevar o nível e criar um servidor FTP você pode seguir o tutorial: <a href="https://blog.remontti.com.br/136" target="_blank" rel="noopener">Servidor FTP com usuários no banco de dados MySQL</a></p>
<p>Como está criando um ambiente para programar é interessante receber os erros do PHP, então edite as configurações do php.ini ele fica em <strong>/etc/php5/apache2/php.ini</strong><br />
Procure por <strong>display_errors</strong> e altere para <strong>On</strong> </p>
<pre class="remontti-code">display_errors = On</pre>
<p>O padrão para upload de arquivos no PHP é de 2M. Você este valor procurando por <strong>upload_max_filesize</strong> e colocando o valor que achar melhor.</p>
<pre class="remontti-code">upload_max_filesize = 20M</pre>
<p>A cada alteração feita no php.ini deve ser restartado o apache.</p>
<pre class="remontti-code"># /etc/init.d/apache2 restart</pre>
<p>Se precisar ver os logs você encontra em <strong>/var/log/apache2/</strong>. Se você reparar vai ver que la na configuração do domínio no apache temos o valor <em>[ErrorLog ${APACHE_LOG_DIR}/dominio2.com.br_error.log]</em>.<br />
Ex de comando para  visualizar:</p>
<pre class="remontti-code"># tail -f /var/log/apache2/dominio1.com.br_error.log </pre>
<p>Agora cada vez que deseja criar um domínio fake:<br />
<strong>1 &#8211;</strong> Crie um arquivo/etc/apache2/sites-enabled/dominiofake.com.conf  (sempre terminando em .conf)</p>
<pre class="remontti-code">Conforme modelos acima.</pre>
<p><strong>2 &#8211;</strong> Insira no /etc/bind/db.fakes.zone seu dominofake.com </p>
<pre class="remontti-code">*.dominiofake.com       IN CNAME .
dominiofake.com         IN CNAME .</pre>
<p><strong>3 &#8211; </strong> Restart o apcache e o Bind</p>
<pre class="remontti-code">/etc/init.d/bind9  restart
/etc/init.d/apache2 restart</pre>
<p>Você pode criar também um usuário MySQL para cada aplicação sua, para separar as bases de dados, segue um ex. onde criamos a base de dados dominio1 com o usuario dominio1 e SENHA:</p>
<pre class="remontti-code"># mysql -u root -p</pre>
<p>Você pode usar o phpmyadmin também.</p>
<pre class="remontti-code">CREATE DATABASE dominio1;
GRANT ALL PRIVILEGES ON dominio1.* TO &#039;dominio1&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUA-SENHA-DOM1&#039;;
FLUSH PRIVILEGES;
quit;</pre>
<p><strong>Pensando em facilitar sua vida, vou criar dois shell script. Uma para adicionar um domínio com apenas um comando, e outro para remover.</strong></p>
<pre class="remontti-code">vim /bin/adddominio</pre>
<pre class="remontti-code">#!/bin/bash

DOMINIO=$1

if [ -z $DOMINIO ];then
        echo
        echo &quot;Comando imcompleto!&quot;
        echo &quot; Use ex.: adddominio dominio.tld&quot;
        echo
else
        EXITE=`ls -lh /etc/apache2/sites-enabled/ |grep ${DOMINIO} |wc -l`
        echo
        if [ $EXITE = 1 ]; then
                        printf &quot;\033[1;31m ${DOMINIO} \033[0m já cadastrado! \n&quot;
        else

                mkdir /var/www/dom_fakes/${DOMINIO}

                cat &lt;&lt;&lt; &quot;
                &lt;VirtualHost *:80&gt;
                        ServerName ${DOMINIO}
                        ServerAlias www.${DOMINIO}

                        ServerAdmin seu@email.com.br
                        DocumentRoot /var/www/dom_fakes/${DOMINIO}
                        &lt;Directory /var/www/dom_fakes/${DOMINIO}/&gt;
                                Options Indexes FollowSymLinks
                                AllowOverride All
                        &lt;/Directory&gt;

                        LogLevel warn

                        ErrorLog ${APACHE_LOG_DIR}/${DOMINIO}_error.log
                        CustomLog ${APACHE_LOG_DIR}/${DOMINIO}_access.log combined
                &lt;/VirtualHost&gt;
                &quot; &gt; /etc/apache2/sites-enabled/${DOMINIO}.conf

                echo &quot;*.${DOMINIO}       IN CNAME .&quot; &gt;&gt; /etc/bind/db.fakes.zone
                echo &quot;${DOMINIO}         IN CNAME .&quot; &gt;&gt; /etc/bind/db.fakes.zone

                chown  www-data. /var/www/dom_fakes/${DOMINIO}

                /etc/init.d/bind9 restart
                /etc/init.d/apache2 restart

                echo

                printf &quot;\033[1;32m$DOMINIO \033[0m configurado com sucesso! \n&quot;
        fi
        echo
fi</pre>
<pre class="remontti-code">vim /bin/deldominio</pre>
<pre class="remontti-code">#!/bin/bash

DOMINIO=$1

if [ -z $DOMINIO ];then
        echo
        echo &quot;Comando imcompleto!&quot;
        echo &quot; Use ex.: deldominio dominio.tld&quot;
        echo
else
        EXITE=`ls -lh /etc/apache2/sites-enabled/ |grep ${DOMINIO} |wc -l`
        echo
        if [ $EXITE = 0 ]; then
                        printf &quot;\033[1;31m ${DOMINIO} \033[0m não encontrado! \n&quot;
        else
                rm -rf /var/www/dom_fakes/${DOMINIO}

                rm -f /etc/apache2/sites-enabled/${DOMINIO}.conf

                sed -i &quot;/${DOMINIO}/d&quot; /etc/bind/db.fakes.zone

                /etc/init.d/bind9 restart
                /etc/init.d/apache2 restart
                echo
                printf &quot;\033[1;32m$DOMINIO \033[0m removido com sucesso! \n&quot;
        fi
        echo
fi
</pre>
<p>Altere as permissões.</p>
<pre class="remontti-code"># chmod +x /bin/adddominio
# chmod +x /bin/deldominio</pre>
<p>Pronto agora bastar você usar o comando adddominio para adicionar todas as configurações automaticamente e deldominio para remove-las.<br />
Adicionando:</p>
<pre class="remontti-code">adddominio dominio3.com</pre>
<p>Removendo:</p>
<pre class="remontti-code">deldominio dominio3.com</pre>
<p>Parabéns! Você montou um servidor próprio! </p>
<p>Agora se você quer dar uma de preguiçoso vou deixar aqui o link para você importar a VM em seu virtual box.<br />
<strong><a href="https://mega.nz/#!FtYhCLLY!3Hyjmp2u0fNVXmLe0RUi18NEb8oJv08ZxrPgXeFMN_A" target="_blank" rel="noopener">Dev Web Server.ova</a> 765MB (64bits)</strong><br />
Abra seu Virtual Box vá em: Arquivo &#8211;>  Importar Amppliance e selecione o arquivo.</p>
<pre class="remontti-code">Usuários / Senhas
SSH:
webdev / remontti
root / remontti
www-data / remontti (SFTP)

MySQL
root / remontti
phpmyadmin / remontti</pre>
<p>Se gostou, ficou com dúvida deixe seu comentário.</p>
<p>Abraço!</p>
<p>O post <a href="https://blog.remontti.com.br/1730">Criando uma maquina virtual com linux (Debian) para Desenvolvedores Web (LDAMPS)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/1730/feed</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>Passo-a-passo como criar um servidor web Apache2, PHP5, MySQL, PHPMyAdmin &#8220;LAMP&#8221; no Debian 8</title>
		<link>https://blog.remontti.com.br/1296</link>
					<comments>https://blog.remontti.com.br/1296#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Sat, 24 Sep 2016 13:42:48 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2.php5.mysql]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[mysql-server]]></category>
		<category><![CDATA[passo a passo]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[Server]]></category>
		<guid isPermaLink="false">http://blog.remontti.com.br/?p=1296</guid>

					<description><![CDATA[<p>Esse tutorial vai em especial para os estagiários! 😀 Distribuição utilizada: Debian 8 Jessie / Instalação Limpa Antes de começar  vamos atualizar nosso repositório / pacotes já instalado. # apt update # apt upgrade #&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/1296">Passo-a-passo como criar um servidor web Apache2, PHP5, MySQL, PHPMyAdmin &#8220;LAMP&#8221; no Debian 8</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Esse tutorial vai em especial para os estagiários! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Distribuição utilizada: Debian 8 Jessie / <a href="https://blog.remontti.com.br/1152">Instalação Limpa</a></p>
<p>Antes de começar  vamos atualizar nosso repositório / pacotes já instalado.</p>
<pre class="remontti-code"># apt update
# apt upgrade
# apt install apache2 libapache2-mod-php5 php5 mysql-server phpmyadmin</pre>
<p>Instale todos os pacotes dependentes. (S)</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_092925.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1297" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_092925-300x205.png" alt="screenshot_20160924_092925" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_092925-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_092925-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_092925-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_092925.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Sete a senha do root do mysql, está senha não é a senha do usuário root do sistema e sim uma senha que você vai estar criando para seu usuário root do mysql!</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093012.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1298" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093012-300x205.png" alt="screenshot_20160924_093012" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093012-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093012-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093012-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093012.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Repita a senha.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093033.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1299" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093033-300x205.png" alt="screenshot_20160924_093033" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093033-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093033-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093033-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093033.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Selecione a opção apache2.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093047.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1300" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093047-300x205.png" alt="screenshot_20160924_093047" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093047-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093047-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093047-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093047.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Configurando o phpmyadmin:<br />
Responda sim.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093330.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1301" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093330-300x205.png" alt="screenshot_20160924_093330" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093330-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093330-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093330-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093330.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Informe a senha do administrador que no caso é nosso usuário <strong>root do MYSQL </strong>que informamos<strong> </strong>anteriormente.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_103820.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1308" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_103820-300x205.png" alt="screenshot_20160924_103820" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_103820-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_103820-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_103820-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_103820.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Agora você vai digitar uma senha para o usuário chamado phpmyadmin.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093509.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1302" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093509-300x205.png" alt="screenshot_20160924_093509" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093509-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093509-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093509-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093509.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Repita a senha.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093530.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1303" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093530-300x205.png" alt="screenshot_20160924_093530" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093530-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093530-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093530-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_093530.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Instalação concluída!</p>
<p>Acesse <strong>http://ip-do-seu-servidor/</strong></p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_094733.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1304" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_094733-300x225.png" alt="screenshot_20160924_094733" width="300" height="225" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_094733-300x225.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_094733-768x575.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_094733.png 959w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Acesse <strong>http://ip-do-seu-servidor/phpmyadmin</strong></p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095016.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1305" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095016-300x225.png" alt="screenshot_20160924_095016" width="300" height="225" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095016-300x225.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095016-768x575.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095016.png 959w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095023.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1306" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095023-300x225.png" alt="screenshot_20160924_095023" width="300" height="225" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095023-300x225.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095023-768x575.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095023.png 959w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
Agora vamos habilitar o <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html">mod_rewrite</a> do Apache que é muito utilizado. Este é um módulo do Apache que utiliza um mecanismo baseado em regras de reescrita.</p>
<p>Diretório de configurações do Apache fica em <strong>/etc/apache2/</strong></p>
<p>Vamos ao comando para habilita-lo:</p>
<pre class="remontti-code"># a2enmod rewrite</pre>
<p>A página que vimos ao abri o ip do nosso servidor no navegador fica no diretório /var/www/html, isso está sendo informado no arquivo default do apache que fica em <em>/etc/apache2/sites-enabled/000-default.conf</em>, e para que nosso <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html">mod_rewrite</a> funcione corretamente será necessário adicionar alguma linhas.</p>
<p>Edite o arquivo /etc/apache2/sites-enabled/000-default.conf (vou usar o editor vim, que não vem instalado por padrão no sistema, mas se você pode usar qualquer edito ex o nano)</p>
<pre class="remontti-code"># vim /etc/apache2/sites-enabled/000-default.conf</pre>
<p>Adicione abaixo de &#8220;<span style="color: #000080;"><strong>DocumentRoot /var/www/html</strong>&#8220;</span> o seguinte:</p>
<pre class="remontti-code">	
	&lt;Directory /var/www/html/&gt;
    		Options FollowSymLinks
    		AllowOverride All
	&lt;/Directory&gt;
</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095440.png" data-rel="lightbox-gallery-X0vO5NlJ" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1307" src="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095440-300x205.png" alt="screenshot_20160924_095440" width="300" height="205" srcset="https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095440-300x205.png 300w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095440-768x525.png 768w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095440-1024x700.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2016/09/Screenshot_20160924_095440.png 1047w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Agora precisamos restartar nosso apache para que tenha efeito nossas alterações.</p>
<pre class="remontti-code"># /etc/init.d/apache2 restart</pre>
<p>Existe também a opçao de restart um serviço utilizando o comando # service</p>
<pre class="remontti-code"># service apache2 restart</pre>
<p>Porém eu sou mais fã do velho /et/init.d/&#8230;</p>
<p>Pronto! Seu servidor está proto para a &#8220;diversão&#8221;.</p>
<p>O post <a href="https://blog.remontti.com.br/1296">Passo-a-passo como criar um servidor web Apache2, PHP5, MySQL, PHPMyAdmin &#8220;LAMP&#8221; no Debian 8</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/1296/feed</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>FreeBSD v8.0 +  Apache + Mysql + PHP “FAMP”</title>
		<link>https://blog.remontti.com.br/648</link>
					<comments>https://blog.remontti.com.br/648#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Mon, 04 Jan 2010 19:23:42 +0000</pubDate>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache22]]></category>
		<category><![CDATA[famp]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">http://www.remontti.com.br/blog/?p=648</guid>

					<description><![CDATA[<p>Primeiramente vamos instalar o mysql, para não ficarmos com dependências&#8230; para os amigos de primeira viagem no freebsd usamos os ports para instalação de pacotes, vamos suporte que eu esteja querendo instalar algum pacote&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/648">FreeBSD v8.0 +  Apache + Mysql + PHP “FAMP”</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.remontti.com.br/blog/wp-content/uploads/2010/01/postcard2.gif" data-rel="lightbox-gallery-Oy6qANM0" data-rl_title="" data-rl_caption=""><img loading="lazy" decoding="async" class="size-full wp-image-655 alignleft" title="" src="https://www.remontti.com.br/blog/wp-content/uploads/2010/01/postcard2.gif" alt="" width="260" height="328" srcset="https://blog.remontti.com.br/wp-content/uploads/2010/01/postcard2.gif 260w, https://blog.remontti.com.br/wp-content/uploads/2010/01/postcard2-237x300.gif 237w" sizes="auto, (max-width: 260px) 100vw, 260px" /></a>Primeiramente vamos instalar o mysql, para não ficarmos com dependências&#8230; para os amigos de primeira viagem no freebsd usamos os ports para instalação de pacotes, vamos suporte que eu esteja querendo instalar algum pacote e não sei seu diretório, entre em http://www.freshports.org/ e em search faça sua busca, não vou entrar em detalhes. Vamos à instalação:</p>
<p><span id="more-648"></span></p>
<h2><strong>ATUALIZANDO PORTS</strong></h2>
<p><span style="color: #ff6600;"># portsnap fetch<br />
# portsnap extract<br />
# portsnap update</span></p>
<h2><strong>MYSQL </strong></h2>
<p><span style="color: #ff6600;"># cd /usr/ports/databases/mysql51-server/<br />
# make install clean</span></p>
<p>Options for libiconv (padrão)</p>
<p>O processo de compilação pode demorar vários minutos&#8230;</p>
<p>Agora vamos ativa-lo, após starta-lo e reiniciar nosso server para verificar se tudo esta ok.</p>
<p><span style="color: #ff6600;"># echo &#8216;mysql_enable=&#8221;YES&#8221;&#8216; &gt;&gt; /etc/rc.conf<br />
# /usr/local/etc/rc.d/mysql-server start<br />
# reboot<br />
Adicionando uma senha a seu usuário root<br />
# mysqladmin -u root password SUA_SENHA<br />
# history -c</span></p>
<h2><strong>APACHE</strong></h2>
<p><span style="color: #ff6600;"># cd /usr/ports/www/apache22/<br />
# make config </span></p>
<p>Quando for solicitado marque apenas as opções a baixo:</p>
<pre class="remontti-code">Apache2 Options

[X] THREADS               Enable threads support in APR
[X] MYSQL                 Enable MySQL support for apr-dbd
[X] IPV6                  Enable IPv6 support
[X] BDB                   Enable BerkeleyDB dbm
[X] AUTH_BASIC            Enable mod_auth_basic
[X] AUTH_DIGEST           Enable mod_auth_digest
[X] AUTHN_FILE            Enable mod_authn_file
[X] AUTHN_DBD             Enable mod_authn_dbd
[X] AUTHN_DBM             Enable mod_authn_dbm
[X] AUTHN_ANON            Enable mod_authn_anon
[X] AUTHN_DEFAULT         Enable mod_authn_default
[X] AUTHN_ALIAS           Enable mod_authn_alias
[X] AUTHZ_HOST            Enable mod_authz_host
[X] AUTHZ_GROUPFILE       Enable mod_authz_groupfile
[X] AUTHZ_USER            Enable mod_authz_user
[X] AUTHZ_DBM             Enable mod_authz_dbm
[X] AUTHZ_OWNER           Enable mod_authz_owner
[X] AUTHZ_DEFAULT         Enable mod_authz_default
[X] CACHE                 Enable mod_cache
[X] DISK_CACHE            Enable mod_disk_cache
[X] FILE_CACHE            Enable mod_file_cache
[X] DAV                   Enable mod_dav
[X] DAV_FS                Enable mod_dav_fs
[X] ACTIONS               Enable mod_actions
[X] ALIAS                 Enable mod_alias
[X] ASIS                  Enable mod_asis
[X] AUTOINDEX             Enable mod_autoindex
[X] CERN_META             Enable mod_cern_meta
[X] CHARSET_LITE          Enable mod_charset_lite
[Y] DBD                   Enable mod_dbd
[X] DEFLATE               Enable mod_deflate
[X] DIR                   Enable mod_dir
[X] DUMPIO                Enable mod_dumpio
[X] ENV                   Enable mod_env
[X] EXPIRES               Enable mod_expires
[X] HEADERS               Enable mod_headers
[X] IMAGEMAP              Enable mod_imagemap
[X] INCLUDE               Enable mod_include
[X] INFO                  Enable mod_info
[X] LOG_CONFIG            Enable mod_log_config
[X] LOGIO                 Enable mod_logio
[X] MIME                  Enable mod_mime
[X] MIME_MAGIC            Enable mod_mime_magic
[X] NEGOTIATION           Enable mod_negotiation
[X] REWRITE               Enable mod_rewrite
[X] SETENVIF              Enable mod_setenvif
[X] SPELING               Enable mod_speling
[X] STATUS                Enable mod_status
[X] UNIQUE_ID             Enable mod_unique_id
[X] USERDIR               Enable mod_userdir
[X] USERTRACK             Enable mod_usertrack
[X] VHOST_ALIAS           Enable mod_vhost_alias
[X] FILTER                Enable mod_filter
[X] VERSION               Enable mod_version
[X] PROXY                 Enable mod_proxy
[X] SSL                   Enable mod_ssl
[X] SUEXEC                Enable mod_suexec
</pre>
<pre class="remontti-code">Options for perl 5.8

[X] PERL_MALLOC    Use Perl malloc
[X] PERL_64BITINT  Use 64 bit integers (on i386)
[X] USE_PERL       Rewrite links in /usr/bin
</pre>
<pre class="remontti-code">Options for m4 (não marque nada)
[ ] LIBSIGSEGV  Use libsigsegv for better diagnostics</pre>
<p><span style="color: #ff6600;"># make install clean clean-depends</span></p>
<p>Uma vez que o Apache está instalado corretamente, você deve configurar seu servidor. Primeiro, ativar o suporte a SSL e criar o certificado e arquivos fundamentais.</p>
<p><span style="color: #ff6600;"># echo &#8216;apache22_enable=&#8221;YES&#8221;&#8216; &gt;&gt; /etc/rc.conf</span></p>
<p><span style="color: #ff6600;"># echo &#8216;apache22ssl_enable=&#8221;YES&#8221;&#8216; &gt;&gt; /etc/rc.conf<br />
# echo &#8216;accf_http_ready=&#8221;YES&#8221;&#8216; &gt;&gt; /etc/rc.conf<br />
# kldload accf_http</span></p>
<p><span style="color: #ff6600;"># /usr/local/etc/rc.d/apache22 start</span></p>
<p><span style="color: #ff6600;"># cd /usr/local/etc/apache22/<br />
# openssl genrsa -des3 -out server.key 1024</span><br />
Generating RSA private key, 1024 bit long modulus<br />
.++++++<br />
&#8230;&#8230;&#8230;&#8230;&#8230;++++++<br />
e is 65537 (0x10001)<br />
Enter pass phrase for server.key:<strong> SUA_SENHA</strong><br />
Verifying &#8211; Enter pass phrase for server.key: <strong>SUA_SENHA</strong></p>
<p><span style="color: #ff6600;"># openssl req -new -key server.key -out server.csr</span><br />
Enter pass phrase for server.key: <strong>SUA_SENHA</strong><br />
You are about to be asked to enter information that will be incorporated<br />
into your certificate request.<br />
What you are about to enter is what is called a Distinguished Name or a DN.<br />
There are quite a few fields but you can leave some blank<br />
For some fields there will be a default value,<br />
If you enter &#8216;.&#8217;, the field will be left blank.<br />
&#8212;&#8211;<br />
Country Name (2 letter code) [AU]:BR<br />
State or Province Name (full name) [Some-State]:Rio Grande do Sul<br />
Locality Name (eg, city) []:Fred. West.<br />
Organization Name (eg, company) [Internet Widgits Pty Ltd]:remontti<br />
Organizational Unit Name (eg, section) []:<br />
Common Name (eg, YOUR name) []:<br />
Email Address []:</p>
<p>Please enter the following &#8216;extra&#8217; attributes<br />
to be sent with your certificate request<br />
A challenge password []:<br />
An optional company name []:</p>
<p><span style="color: #ff6600;"># openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt</span><br />
Signature ok<br />
subject=/C=BR/ST=Rio Grande do Sul/L=Fred. West./O=remontti<br />
Getting Private key<br />
Enter pass phrase for server.key: <strong>SUA_SENHA</strong></p>
<p><span style="color: #ff6600;"># chmod 0400 server.key server.crt<br />
# cd /usr/local/www/apache22/<br />
# mkdir ssl<br />
# cd /usr/local/etc/apache22/<br />
# vi httpd.conf</span></p>
<p>Comente as seguintes linhas:<br />
<span style="color: #3366ff;"><em>#LoadModule authz_owner_module libexec/apache22/mod_authz_owner.so<br />
#LoadModule file_cache_module libexec/apache22/mod_file_cache.so<br />
#LoadModule cache_module libexec/apache22/mod_cache.so<br />
#LoadModule disk_cache_module libexec/apache22/mod_disk_cache.so<br />
#ScriptAlias /cgi-bin/ &#8220;/usr/local/www/apache22/cgi-bin/&#8221;</em></span></p>
<p>Descomente:<br />
<span style="color: #3366ff;">Include etc/apache22/extra/httpd-ssl.conf </span> #(Fazendo isso quando vc reiniciar o serviço ou o Server será solicitado senha)<br />
<span style="color: #3366ff;">AddType text/html .shtml<br />
AddOutputFilter INCLUDES .shtml<br />
MIMEMagicFile etc/apache22/magic </span></p>
<p>Altere:<br />
<span style="color: #3366ff;">ServerAdmin seu@email.com<br />
DirectoryIndex index.html index.htm</span></p>
<p>Adicione:<br />
<span style="color: #3366ff;">ServerSignature Off</span></p>
<p># vi /usr/local/etc/apache22/extra/httpd-ssl.conf<br />
Se vc desejar trocar o diretório do DocumentRoot para o seu diretório entre outras de acordo com suas necessidades.<br />
DocumentRoot &#8220;/usr/local/www/apache22/XXXX&#8221;</p>
<p><span style="color: #ff9900;"># /usr/local/etc/rc.d/apache22 restart</span><br />
Enter pass phrase: <strong>SUA_SENHA do ssl</strong></p>
<h2><strong>PHP5 </strong></h2>
<p><span style="color: #ff6600;"># cd /usr/ports/lang/php5<br />
# make config </span></p>
<pre class="remontti-code">Options for php5 5.2.12   

[X] CLI        Build CLI version
[X] CGI        Build CGI version
[X] APACHE     Build Apache module
[X] DEBUG      Enable debug
[X] SUHOSIN    Enable Suhosin protection system (not for jails)
[X] MULTIBYTE  Enable zend multibyte support
[X] IPV6       Enable ipv6 support
[X] MAILHEAD   Enable mail header patch
[X] REDIRECT   Enable force-cgi-redirect support (CGI only)
[X] DISCARD    Enable discard-path support (CGI only)
[X] FASTCGI    Enable fastcgi support (CGI only)
[X] PATHINFO   Enable path-info-check support (CGI only)</pre>
<p><span style="color: #ff6600;"># make install clean<br />
# cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini<br />
# echo &#8216;#CONFIGURACAO PHP5&#8217; &gt;&gt; /usr/local/etc/apache22/httpd.conf<br />
# echo &#8216;AddType application/x-httpd-php .php&#8217; &gt;&gt; /usr/local/etc/apache22/httpd.conf<br />
# echo &#8216;AddType application/x-httpd-php-source .phps&#8217; &gt;&gt; /usr/local/etc/apache22/httpd.conf<br />
# vi /usr/local/etc/apache22/httpd.conf</span></p>
<p>Adicione ao DirectoryIndex deixando assim:<br />
<span style="color: #3366ff;">DirectoryIndex index.html index.htm <strong>index.php</strong></span></p>
<p><span style="color: #ff6600;"># vi /usr/local/etc/php.ini</span><br />
<span style="color: #3366ff;">Altere: short_open_tag = On</span></p>
<h2>PHP5-Extensions</h2>
<p><span style="color: #ff6600;"># cd /usr/ports/lang/php5-extensions<br />
# make install clean</span></p>
<pre class="remontti-code">PHP5-Extensions Options
[X] BZ2         bzip2 library support
[X] CTYPE       ctype functions
[X] CURL        CURL support
[X] DBA         dba support
[X] DOM         DOM support
[X] FILEINFO    fileinfo support
[X] FILTER      input filter support
[X] FTP         FTP support
[X] GD          GD library support
[X] HASH        HASH Message Digest Framework
[X] ICONV       iconv support
[X] IMAP        IMAP support
[X] JSON        JavaScript Object Serialization support
[X] MCRYPT      Encryption support
[X] MHASH       Crypto-hashing support
[X] MYSQL       MySQL database support
[X] PDO         PHP Data Objects Interface (PDO)
[X] PDO_SQLITE  PDO sqlite driver
[X] POSIX       POSIX-like functions
[X] SESSION     session support
[X] SHMOP       shmop support
[X] SIMPLEXML   simplexml support
[X] SOAP        SOAP support
[X] SOCKETS     sockets support
[X] SPL         Standard PHP Library
[X] SQLITE      sqlite support
[X] TOKENIZER   tokenizer support
[X] XML         XML support
[X] XMLREADER   XMLReader support
[X] XMLRPC      XMLRPC-EPI support
[X] XMLWRITER   XMLWriter support
[X] ZIP         ZIP support</pre>
<p>Deixe marcado o que esta por padrão para todas as próximas opções</p>
<p><span style="color: #ff6600;"># /usr/local/etc/rc.d/apache22 restart</span></p>
<h2>PhpMyAdmin</h2>
<p><span style="color: #ff6600;"># cd /usr/ports/databases/phpmyadmin211/</span></p>
<p><span style="color: #ff6600;"># make install clean</span></p>
<pre class="remontti-code">Options for phpMyAdmin211 2.11.9.6

[ ] SUPHP     suPHP support
[X] BZ2       bzip2 library support
[X] GDGD 	  library support
[X] OPENSSL   OpenSSL support
[X] PDF       PDFlib support (implies GD)
[X] ZLIB      ZLIB support
[X] MCRYPT    MCrypt library support
[X] MBSTRING  Multi-byte character-set string support</pre>
<p><span style="color: #ff6600;"># cp /usr/local/www/phpMyAdmin211/libraries/config.default.php /usr/local/www/phpMyAdmin211/config.inc.php</span></p>
<p><span style="color: #ff6600;"># vim /usr/local/www/phpMyAdmin211/config.inc.php</span><br />
Altere: <span style="color: #3366ff;">$cfg[&#8216;Servers&#8217;][$i][&#8216;auth_type&#8217;] = &#8216;config&#8217;;</span><br />
para: <span style="color: #3366ff;">$cfg[&#8216;Servers&#8217;][$i][&#8216;auth_type&#8217;] = &#8216;<strong>http</strong>&#8216;;</span></p>
<p>Adicione no httpd.conf<br />
<span style="color: #ff6600;"># /usr/local/etc/apache22/httpd.conf</span></p>
<pre class="remontti-code">Alias /phpmyadmin &quot;/usr/local/www/phpMyAdmin211/&quot;

&lt;Directory &quot;/usr/local/www/phpMyAdmin211/&quot;&gt;
    Options none
    AllowOverride Limit

    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ip_da_sua_rede


</pre>
<p>Isso ai galera, abraço!</p>
<p>O post <a href="https://blog.remontti.com.br/648">FreeBSD v8.0 +  Apache + Mysql + PHP “FAMP”</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/648/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
