Skip to content

Instantly share code, notes, and snippets.

View aristidesneto's full-sized avatar

Aristides Neto aristidesneto

View GitHub Profile
@aristidesneto
aristidesneto / permissions
Created December 19, 2017 22:15
Alterar permissão de pastas e arquivos web
find /var/www/yourdomain.com/html/ -type d -exec chmod 755 {} \;
find /var/www/yourdomain.com/html/ -type f -exec chmod 644 {} \;
sudo chown -hR www-data:www-data /var/www/yourdomain.com/html/
@aristidesneto
aristidesneto / swap
Created December 22, 2017 17:56
Adicionar swap ao sistema
# Cria uma partição (swapfile) na raiz do sistema e ativa em seguida
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
# Editar o arquivo /etc/fstab e adicionar a linha abaixo
/swapfile none swap sw 0 0
# Confirme se deu certo
@aristidesneto
aristidesneto / php
Last active December 1, 2018 02:59
Configurações de desempenho do PHP
## Configurações de desempenho do PHP
# /etc/php/VERSAO_PHP/fpm/php.ini
max_execution_time = 180
max_input_time = 180
memory_limit = 256M
post_max_size = 128M
cgi.fix_pathinfo = 0
upload_max_filesize = 128M
max_file_uploads = 128
<title>Aqui vai o titulo da página</title>
<meta name="description" content="Descrição do seu site" />
<meta name="author" content="Author so Site" />
<meta name="robots" content="index, follow">
<link rel="base" href="https://www.meusite.com.br" />
<link rel="canonical" href="https://www.meusite.com.br" />
<link rel="sitemap" type="application/xml" href="https://www.meusite.com.br/sitemap.xml" />
<link rel="author" href="https://plus.google.com/+SuaPaginaGooglePlus/posts" />
<link rel="publisher" href="https://plus.google.com/+SuaPaginaGooglePlus" />
@aristidesneto
aristidesneto / install.sh
Created January 22, 2018 20:04
PHP-MariaDB
apt-get update
apt-get install ca-certificates -y
echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
echo "deb http://mirror.edatel.net.co/mariadb/repo/10.1/debian jessie main" >> /etc/apt/sources.list
echo "deb-src http://mirror.edatel.net.co/mariadb/repo/10.1/debian jessie main" >> /etc/apt/sources.list
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
@aristidesneto
aristidesneto / jailkit
Last active June 8, 2018 03:43
Executar comandos GIT, PHP e Composer com usuário Jail (CHROOT)
## Painel ISPConfig 3
## Adicionar diretivas para usuario em Jail executar comando como GIT, PHP e Composer
# /etc/jailkit/jk_init.ini
# [GIT]
# Já vem como padrão no arquivo
[php]
comment = the php interpreter
executables = /usr/bin/php, /usr/bin/php5, /usr/bin/php7.1
MY_IP=0.0.0.0
# Create the ipset list
ipset -N china hash:net
ipset -N tor iphash
# remove any old list that might exist from previous runs of this script
rm cn.zone
rm tor.zone
# Pull the latest IP set for China and Tor
@aristidesneto
aristidesneto / ISPConfig + Laravel
Last active May 24, 2018 02:59
Diretiva Nginx para usar Laravel e ISPConfig3
location = /robots.txt {
root {DOCROOT}public;
access_log off;
log_not_found off;
allow all;
}
location / {
root {DOCROOT}public;
try_files $uri $uri/ /index.php?q=$uri&$args;
@aristidesneto
aristidesneto / filter.d_nginx-auth.conf
Created August 14, 2018 23:14 — forked from JulienBlancher/filter.d_nginx-auth.conf
Fail2ban Config with Nginx and SSH
#
# Auth filter /etc/fail2ban/filter.d/nginx-auth.conf:
#
# Blocks IPs that makes too much accesses to the server
#
[Definition]
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*"
ignoreregex =
@aristidesneto
aristidesneto / change_password
Created August 22, 2018 15:13
Alterar senha de root do MariaDB
Após instalar o MariaDB você consiga entrar no banco de dados sem senha ou mesmo digitando qualquer senha ele entra, faça os passos a seguir para resolver esse problema.
1 - Conectar no banco:
sudo mysql -u root
2 - Consultar usuário cadastrados na tabela user
SELECT user, host FROM mysql.user;
+------------------+-----------+
| User | Host |