====== NGINX ======
===== Install =====
apt install nginx
===== Status =====
systemctl status nginx
===== Restart =====
systemctl restart nginx
systemctl reload nginx
===== Testar =====
sudo nginx -t
===== Local de configurações de SITE =====
* Cria-se os arquivos por padrão em: ''/etc/nginx/sites-available/''
* Depois cria-se um link dentro de: ''/etc/nginx/sites-enabled/''
==== Ativação ====
Comando para criação do link dentro de sites-enabled:
sudo ln -s /etc/nginx/sites-available/exemplo.com.br /etc/nginx/sites-enabled/exemplo.com.br
==== Desativação ====
Comando para remoção do link dentro de sites-enabled:
sudo rm /etc/nginx/sites-enabled/exemplo.com.br
==== Ver sites ativos ====
ls -la /etc/nginx/sites-enabled/
===== UTIL =====
Verificar portas utilizadas:
ss -ltup
Verificar DNS:
dig +short trello.itti.org.br
Verificar IP Público do servidor:
curl ifconfig.me
Após qualquer modificação no arquivo, restart o serviço nginx.
===== Config =====
== Debian Path ==
/etc/nginx/
==== FILE "nginx.conf" ====
worker_processes 1; #ou auto
worker_connections 1024; #quantidades de conexões
http{ #configurações de http
server{ #local de configurações das conexões
listen 80; #porta de conexão
listen [::]:80;
server_name localhost;#colocar o nome do domínio
location /{ #configuração quando recebe requisição para apenas '/'
root html;
index index.html index.htm;
}
}
}
==== FILE "default" ====
== Debian path ==
/etc/nginx/sites-enabled/
server {
listen 80;
listen [::]:80;
server_name trello.itti.org.br;
root /var/www/html;
location /.well-known/acme-challenge/ {
alias /var/www/html/.well-known/acme-challenge/;
allow all;
}
location / {
proxy_pass http://localhost:1337;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
===== PROXY REVERSE =====
===== ERROS NGINX =====
==== Nginx: Failed to start A high performance web server and a reverse proxy server ====
HTTP 80 port já esta sendo usada:
sudo service apache2 stop
sudo systemctl restart nginx
==== Referências e Agradecimentos ====
[[https://www.youtube.com/watch?v=DyXl4c2XN-o&t=310s&ab_channel=ChristianLempa| YOUTUBE - Christian Lempa]]