Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

476
Visualizações
Nginx showing 403 forbidden

I have hosted react app on nginx, when i try to access any file with extension (e.g favicon.ico), nginx throws 403 forbidden error although it works fine for basic app routing i.e, for files without extension. I'm pasting nginx config below, and the static files that i'm trying to access is in the /var/www/deebaco.com/html. Do i need to write another location block to serve files with extensions?

server {
    listen 80;
    server_name deebaco.com www.deebaco.com;
    return 301 https://www.deebaco.com$request_uri;
}
server {
    listen 443 ssl;
    server_name deebaco.com;

    ssl_certificate /root/deebaco.com.chained.crt;
    ssl_certificate_key /root/deebaco.com.key;
    return 301 https://www.deebaco.com$request_uri;
}

server {
    listen 443 ssl http2;

   add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    server_name www.deebaco.com;
    root /var/www/deebaco.com/html;

    ssl_certificate /root/deebaco.com.chained.crt;
    ssl_certificate_key /root/deebaco.com.key;

    #location / {
    #try_files $uri $uri/ /index.html?$args;
    #}

    location / {
    try_files $uri /index.html;
    autoindex on;
    autoindex_exact_size off;
    }

}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Check the owner of the public directory, for example using this command:

ls -l /var/www/deebaco.com/html

nginx often runs as nobody, Instead, it should run with the same user as the owner.

Edit /etc/nginx/nginx.conf to set the same user. For example, if the directory is owned by www-data, add the following:

user  www-data;

After saving the config, validate that it is correct:

sudo nginx -t

If the command above confirms that the syntax is ok, reload nginx configuration:

sudo systemctl reload nginx.service

This should solve the problem.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda