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

392
Visualizações
nginx location block disables rendering of php files

I have this location block within my website.conf:

 location ~ ^/([^/?&:'"]+)$ {
        try_files $uri @root_path;
    }

This part of the file hinders the execution of php files, it always serves them as download.

  • How can I exclude *.php files from this regex expression?
  • What does that regex even mean?
  • Is it even good style to just exclude *.php files in this case?

If somebody could elaborate I would be very grateful.

Some more context: I'm trying out jitsi-meet and I would like to add some php-based functionality to the website.

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

0

The regular expression ^/([^/?&:'"]+)$ matches anything that begins with a / and contains any character except /, ?, &, :, ' and ".

The first character is significant as it means it will only match URIs that contain a single path element (e.g. /foo and /index.php) but will not match URIs that contain another / (e.g. /foo/, /foo/bar and /foo/index.php).

The other characters are probably a mistake as ? and & is unlikely to be encountered by a location statement as Nginx uses a normalised URI which has had the query string removed.


You do not need to exclude .php from this regular expression.

The URIs ending with .php are usually processed by another regular expression location block (e.g. location ~ \.php$).

Regular expression location blocks are evaluated in order until a match is found, so you need to make sure that the location ~ \.php$ block is placed above the regular expression location block in your question.

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