This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
|||||||
|
# Guia Rapido - Configurar Nginx (SPA React)
|
||||||
|
|
||||||
|
## O Problema
|
||||||
|
|
||||||
|
URLs como `avanzato.com.br/avaliacao` dao 404 quando acessadas diretamente.
|
||||||
|
Funcionam apenas quando clica no menu (navegacao interna do React).
|
||||||
|
|
||||||
|
## A Solucao
|
||||||
|
|
||||||
|
O Nginx precisa redirecionar todas as rotas para `index.html`.
|
||||||
|
|
||||||
|
## Passo a Passo
|
||||||
|
|
||||||
|
### 1. Copiar a config do projeto para o servidor
|
||||||
|
|
||||||
|
No seu Mac, envie o arquivo `nginx.conf` do projeto para o servidor:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Enviar o arquivo nginx.conf do projeto para o servidor
|
||||||
|
scp /Users/avanzato/Projetos/Avanzato/avanzato-site/app/nginx.conf root@SEU_SERVIDOR:/etc/nginx/sites-available/avanzato
|
||||||
|
```
|
||||||
|
|
||||||
|
Ou, se ja estiver logado no servidor:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Logar no servidor
|
||||||
|
ssh root@SEU_SERVIDOR
|
||||||
|
|
||||||
|
# Criar o arquivo de config
|
||||||
|
cat > /etc/nginx/sites-available/avanzato << 'EOF'
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name avanzato.com.br;
|
||||||
|
|
||||||
|
root /var/www/avanzato;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# ESSA LINHA E A CHAVE - redireciona tudo para index.html
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache para assets
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
expires 6M;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Seguranca
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
|
||||||
|
# Bloquear arquivos ocultos
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Ativar o site
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Criar link simbolico (ativa o site)
|
||||||
|
ln -s /etc/nginx/sites-available/avanzato /etc/nginx/sites-enabled/avanzato
|
||||||
|
|
||||||
|
# Remover o default (se existir)
|
||||||
|
rm -f /etc/nginx/sites-enabled/default
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Testar e aplicar
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Testar a configuracao (mostra erros se houver)
|
||||||
|
nginx -t
|
||||||
|
|
||||||
|
# Se der OK, recarregar o Nginx
|
||||||
|
systemctl reload nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Verificar se funcionou
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Testar uma rota direta
|
||||||
|
curl -I https://avanzato.com.br/avaliacao
|
||||||
|
|
||||||
|
# Deve retornar HTTP 200, nao 404
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Comandos Uteis
|
||||||
|
|
||||||
|
| Comando | O que faz |
|
||||||
|
|---------|-----------|
|
||||||
|
| `nginx -t` | Testa a configuracao (sem aplicar) |
|
||||||
|
| `systemctl reload nginx` | Recarrega config sem derrubar o site |
|
||||||
|
| `systemctl restart nginx` | Reinicia o Nginx |
|
||||||
|
| `systemctl status nginx` | Verifica se esta rodando |
|
||||||
|
| `tail -f /var/log/nginx/error.log` | Ver erros em tempo real |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Importante
|
||||||
|
|
||||||
|
Se voce usa **Apache** em vez de Nginx, a config esta no arquivo `.htaccess` que ja vai no `dist/`:
|
||||||
|
|
||||||
|
```apache
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -d
|
||||||
|
RewriteRule ^ - [L]
|
||||||
|
RewriteRule ^ index.html [L]
|
||||||
|
```
|
||||||
|
|
||||||
|
Basta garantir que o `.htaccess` esta na raiz do site e o `mod_rewrite` esta ativado.
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0.9",
|
||||||
|
"date": "2026-05-29",
|
||||||
|
"environment": "development"
|
||||||
|
}
|
||||||
+7
-7
@@ -14,14 +14,14 @@ export const LOGO = {
|
|||||||
// Opcao 1: SVG inline (deixe vazio se for usar imagem)
|
// Opcao 1: SVG inline (deixe vazio se for usar imagem)
|
||||||
svgInline: '',
|
svgInline: '',
|
||||||
|
|
||||||
// Opcao 2: URL da imagem (use quando o logo esta hospedado externamente)
|
// Opcao 2: URL da imagem
|
||||||
// Exemplo: '/assets/logo.png' para arquivo local
|
// Use '/logo.png' para carregar da pasta public/ (funciona em qualquer ambiente)
|
||||||
// Exemplo: 'https://avanzato.com.br/logo.png' para imagem externa
|
// Use 'https://avanzato.com.br/logo.png' apenas se for carregar de servidor externo
|
||||||
imageUrl: 'https://avanzato.com.br/logo.png',
|
imageUrl: '/logo.png',
|
||||||
|
|
||||||
// Texto ao lado do logo (deixe vazio se nao quiser texto)
|
// Texto ao lado do logo (deixe vazio se o logo ja tiver texto)
|
||||||
text: 'avanzato',
|
text: '',
|
||||||
textHighlight: '.', // O ponto verde apos o texto
|
textHighlight: '',
|
||||||
|
|
||||||
// Link do logo (para onde vai quando clica)
|
// Link do logo (para onde vai quando clica)
|
||||||
href: '/',
|
href: '/',
|
||||||
|
|||||||
+11
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Facebook, Youtube, Linkedin, Instagram, ArrowUp, MapPin } from 'lucide-react';
|
import { Facebook, Youtube, Linkedin, Instagram, ArrowUp, MapPin } from 'lucide-react';
|
||||||
import { LOGO, SOCIAL_LINKS, ADDRESSES, FOOTER_LINKS, COMPANY } from '../config/site';
|
import { LOGO, SOCIAL_LINKS, ADDRESSES, FOOTER_LINKS, COMPANY } from '../config/site';
|
||||||
@@ -11,6 +12,15 @@ const socialIcons: Record<string, React.ReactNode> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Footer = () => {
|
const Footer = () => {
|
||||||
|
const [version, setVersion] = useState('');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch('/version.json')
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(data => setVersion(data.version))
|
||||||
|
.catch(() => setVersion(''));
|
||||||
|
}, []);
|
||||||
|
|
||||||
const scrollToTop = () => {
|
const scrollToTop = () => {
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
};
|
};
|
||||||
@@ -161,7 +171,7 @@ const Footer = () => {
|
|||||||
<div className="flex flex-col md:flex-row items-center justify-between gap-4">
|
<div className="flex flex-col md:flex-row items-center justify-between gap-4">
|
||||||
<p className="text-gray-500 text-sm">
|
<p className="text-gray-500 text-sm">
|
||||||
© {new Date().getFullYear()} {COMPANY.name}. Todos os direitos reservados.
|
© {new Date().getFullYear()} {COMPANY.name}. Todos os direitos reservados.
|
||||||
<span className="ml-2 text-gray-600 text-xs">v1.0.4</span>
|
{version && <span className="ml-2 text-gray-600 text-xs">v{version}</span>}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
|
|||||||
@@ -46,14 +46,8 @@ const Navigation = () => {
|
|||||||
<div className="container-custom">
|
<div className="container-custom">
|
||||||
<div className="flex items-center justify-between h-20">
|
<div className="flex items-center justify-between h-20">
|
||||||
{/* Logo - importado de config/site.ts */}
|
{/* Logo - importado de config/site.ts */}
|
||||||
<Link to={LOGO.href} className="flex items-center gap-3">
|
<Link to={LOGO.href} className="flex items-center">
|
||||||
{renderLogo()}
|
{renderLogo()}
|
||||||
{LOGO.text && (
|
|
||||||
<span className="text-2xl font-bold text-white tracking-tight">
|
|
||||||
{LOGO.text}
|
|
||||||
<span className="text-[#cbf400]">{LOGO.textHighlight}</span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* Desktop Navigation - importado de config/site.ts */}
|
{/* Desktop Navigation - importado de config/site.ts */}
|
||||||
|
|||||||
Reference in New Issue
Block a user