Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

391
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda